chdir issues

Help
2009-12-29
2013-05-01
  • Aaron Slunt
    Aaron Slunt
    2009-12-29

    I'm trying to browse the filesystem on my lg xenon phone. Whenever I -c two directories (for example, -c ../Media/Java), the command works, but whenever I try three directories (for example, -c ../Media/Java/ams, and a bunch of other folders like this), I get an error code. I'm not sure if something's going on with obexftp, or if my phone is limiting the number of directories that can be changed at once. Who knows…but here's a debug output. Perhaps someone can tell me what's going down?

           h4x0r bluetooth # obexftp -c ../Media/Java/ams -l                                  
        Scanning for (null) …                                                            
        btkit_discover: Scanning …                                                       
        btkit_discover: Found   00:24:83:3D:2E:EF                                          
        Found: 00:24:83:3D:2E:EF                                                           
        Browsing 00:24:83:3D:2E:EF …                                                     
        obexftp_open()                                                                     
        obexftp_connect_src()                                                              
        Connecting…obexftp_connect_src() BT 1                                            
        cli_sync_request()                                                                 
        \obexftp_sync()
        client_done() 
        client_done() Found connection number: 4164
        client_done() Sender identified           
        obexftp_sync() OBEX_HandleInput = 31      
        obexftp_sync() Done success=1             
        done                                      
        Tried to connect for 860ms                
        obexftp_setpath() Changing to ../Media/Java/ams
        Sending ".."… obexftp_setpath() Setpath ".." (create:0)
        cli_sync_request()                                      
        |obexftp_sync()
        client_done() 
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1     
        Sending "Media"… obexftp_setpath() Setpath "Media" (create:0)
        cli_sync_request()                                            
        /obexftp_sync()
        client_done() 
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1     
        Sending "Java"… obexftp_setpath() Setpath "Java" (create:0)
        cli_sync_request()
        -obexftp_sync()
        client_done()
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1
        Sending "ams"… obexftp_setpath() Setpath "ams" (create:0)
        cli_sync_request()
        \obexftp_sync()
        cli_obex_event() OBEX_EV_REQDONE: obex_rsp=44
        client_done()
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=0
        failed: ../Media/Java/ams
        The operation failed with return code 68
        Receiving "(null)"… obexftp_get_type() Getting (null) -> (null) (x-obex/folder-listing)
        cli_sync_request()
        |obexftp_sync()
        client_done()
        client_done() Found body (length: 253)
        <?xml version="1.0"?>
        <!DOCTYPE folder-listing SYSTEM "obex-Folder-listing.dtd">
        <folder-listing version="1.0">
        <parent-folder />
        <folder name="Other Files" />
        <folder name="Images" />
        <folder name="Sounds" />
        <folder name="Videos" />
        </folder_listing>
        client_done() Done body
        client_done() Body not written
        obexftp_sync() OBEX_HandleInput = 259
        obexftp_sync() Done success=1
        done
        obexftp_disconnect()
        Disconnecting…cli_sync_request()
        /obexftp_sync()
        client_done()
        client_done: Warning: buffer still active?
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1
        done
        obexftp_close()
        obexftp_close: Warning: purging left-over buffer.

     
  • The folder listing doesn't show a "ams" sub-folder. Can you verify there is such a folder a that level? Also is there a reason to put "../" a the front of the path? You should also be able to do e.g. -c Media -c Java -v ams

     
  • Aaron Slunt
    Aaron Slunt
    2009-12-30

    So far I've been having luck with doing -c -c -c. As to why I was using ../, it was to go up one directory. This phone does a weird thing with the ftp. Upon initial connection, it'll only display 3 folders. But doing a -c . displays all of the folder (which happens to be media). So far I've been doing ok in the media folder, but I have to use ../ to go up one folder ot access other directories. Here's an output for you, showing I can't access ../Obigo/brs/hist, but I can access ../Obigo/brs (I tried -C hist and just hist with -v, both failed).

        h4x0r aaron # obexftp -c ../Obigo -c brs -v hist -l
        Scanning for (null) …                           
        btkit_discover: Scanning …                      
        btkit_discover: Found   00:24:83:3D:2E:EF         
        Found: 00:24:83:3D:2E:EF                          
        Browsing 00:24:83:3D:2E:EF …                    
        obexftp_open()                                    
        obexftp_connect_src()                             
        Connecting…obexftp_connect_src() BT 1           
        cli_sync_request()                                
        \obexftp_sync()
        client_done() 
        client_done() Found connection number: 4174
        client_done() Sender identified           
        obexftp_sync() OBEX_HandleInput = 31      
        obexftp_sync() Done success=1             
        done                                      
        Tried to connect for 1149ms               
        obexftp_setpath() Changing to ../Obigo    
        Sending ".."… obexftp_setpath() Setpath ".." (create:0)
        cli_sync_request()                                      
        |obexftp_sync()
        client_done() 
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1     
        Sending "Obigo"… obexftp_setpath() Setpath "Obigo" (create:0)
        cli_sync_request()                                            
        /obexftp_sync()
        client_done() 
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1     
        done                              
        obexftp_setpath() Changing to brs 
        Sending "brs"… obexftp_setpath() Setpath "brs"
        cli_sync_request()                             
        -obexftp_sync()
        client_done() 
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1     
        done                              
        obexftp_setpath() Changing to hist
        Sending "hist"… obexftp_setpath() Setpath "hist"
        cli_sync_request()                               
        \obexftp_sync()
        cli_obex_event() OBEX_EV_REQDONE: obex_rsp=44
        client_done()                               
        obexftp_sync() OBEX_HandleInput = 3         
        obexftp_sync() Done success=0               
        failed: hist                                
        The operation failed with return code 68    
        Receiving "(null)"… obexftp_get_type() Getting (null) -> (null) (x-obex/folder-listing)
        cli_sync_request()                                                                      
        |obexftp_sync()
        client_done() 
        client_done() Found body (length: 253)
        <?xml version="1.0"?>                
        <!DOCTYPE folder-listing SYSTEM "obex-Folder-listing.dtd">
        <folder-listing version="1.0">                           
        <parent-folder />                                        
        <folder name="Other Files" />                            
        <folder name="Images" />                                 
        <folder name="Sounds" />                                 
        <folder name="Videos" />                                 
        </folder_listing>                                        
        client_done() Done body                                  
        client_done() Body not written                           
        obexftp_sync() OBEX_HandleInput = 259                    
        obexftp_sync() Done success=1                            
        done                                                     
        obexftp_disconnect()                                     
        Disconnecting…cli_sync_request()                       
        /obexftp_sync()
        client_done() 
        client_done: Warning: buffer still active?
        obexftp_sync() OBEX_HandleInput = 3      
        obexftp_sync() Done success=1            
        done                                     
        obexftp_close()                          
        obexftp_close: Warning: purging left-over buffer.
        h4x0r aaron # obexftp -c ../Obigo -c brs -l
        Scanning for (null) …                   
        btkit_discover: Scanning …              
        btkit_discover: Found   00:24:83:3D:2E:EF 
        Found: 00:24:83:3D:2E:EF                  
        Browsing 00:24:83:3D:2E:EF …            
        obexftp_open()                            
        obexftp_connect_src()                     
        Connecting…obexftp_connect_src() BT 1   
        cli_sync_request()                        
        \obexftp_sync()
        client_done() 
        client_done() Found connection number: 4175
        client_done() Sender identified           
        obexftp_sync() OBEX_HandleInput = 31      
        obexftp_sync() Done success=1             
        done                                      
        Tried to connect for 1210ms               
        obexftp_setpath() Changing to ../Obigo    
        Sending ".."… obexftp_setpath() Setpath ".." (create:0)
        cli_sync_request()                                      
        |obexftp_sync()
        client_done() 
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1     
        Sending "Obigo"… obexftp_setpath() Setpath "Obigo" (create:0)
        cli_sync_request()
        /obexftp_sync()
        client_done()
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1
        done
        obexftp_setpath() Changing to brs
        Sending "brs"… obexftp_setpath() Setpath "brs"
        cli_sync_request()
        -obexftp_sync()
        client_done()
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1
        done
        Receiving "(null)"… obexftp_get_type() Getting (null) -> (null) (x-obex/folder-listing)
        cli_sync_request()
        \obexftp_sync()
        client_done()
        client_done() Found body (length: 291)
        <?xml version="1.0"?>
        <!DOCTYPE folder-listing SYSTEM "obex-Folder-listing.dtd">
        <folder-listing version="1.0">
        <parent-folder />
        <file name="private_login_data.dat" size="0" />
        <file name="private_data.dat" size="2195" />
        <folder name="hist" />
        <folder name="bookmark" />
        </folder_listing>
        client_done() Done body
        client_done() Body not written
        obexftp_sync() OBEX_HandleInput = 297
        obexftp_sync() Done success=1
        done
        obexftp_disconnect()
        Disconnecting…cli_sync_request()
        |obexftp_sync()
        client_done()
        client_done: Warning: buffer still active?
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1
        done
        obexftp_close()
        obexftp_close: Warning: purging left-over buffer.
        h4x0r aaron #

    You can see in the folder listings that I am indeed requesting a valid folder.

     
  • Aaron Slunt
    Aaron Slunt
    2009-12-30

    And now I'm seeing this when trying to access a 4th directory from within the Media folder, so I guess the directory up is counting as an extra chdir. Perhaps this is the phone causing issues? Hopefully someone can tell me for sure :)

     
  • Please try to list the folder after every setpath so you can check if the sub-folders are there: "-l -c / -l -c Media -l -c Java -l"
    Did you try obexfs? Does it show similar problems?

     
  • Aaron Slunt
    Aaron Slunt
    2009-12-30

            h4x0r mnt # obexftp -c ../Obigo -l -c brs -l -c hist -l
        Scanning for (null) …                               
        btkit_discover: Scanning …                                                                                                                             
        btkit_discover: Found   00:24:83:3D:2E:EF                                                                                                                
        Found: 00:24:83:3D:2E:EF                                                                                                                                 
        Browsing 00:24:83:3D:2E:EF …                                                                                                                           
        obexftp_open()                                                                                                                                           
        obexftp_connect_src()                                                                                                                                    
        Connecting…obexftp_connect_src() BT 1                                                                                                                  
        cli_sync_request()                                                                                                                                       
        \obexftp_sync()
        client_done() 
        client_done() Found connection number: 4098
        client_done() Sender identified           
        obexftp_sync() OBEX_HandleInput = 31      
        obexftp_sync() Done success=1             
        done                                      
        Tried to connect for 941ms                
        obexftp_setpath() Changing to ../Obigo    
        Sending ".."… obexftp_setpath() Setpath ".." (create:0)
        cli_sync_request()                                      
        |obexftp_sync()
        client_done() 
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1     
        Sending "Obigo"… obexftp_setpath() Setpath "Obigo" (create:0)
        cli_sync_request()                                            
        /obexftp_sync()
        client_done() 
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1     
        done                              
        Receiving "(null)"… obexftp_get_type() Getting (null) -> (null) (x-obex/folder-listing)
        cli_sync_request()                                                                      
        -obexftp_sync()
        client_done() 
        client_done() Found body (length: 308)
        <?xml version="1.0"?>                
        <!DOCTYPE folder-listing SYSTEM "obex-Folder-listing.dtd">
        <folder-listing version="1.0">                           
        <parent-folder />                                        
        <folder name="bra" />                                    
        <folder name="brs" />                                    
        <folder name="msm" />                                    
        <folder name="stk" />                                    
        <folder name="wid" />                                    
        <folder name="temp" />                                   
        <folder name="usr_data" />                               
        </folder_listing>                                        
        client_done() Done body                                  
        client_done() Body not written                           
        obexftp_sync() OBEX_HandleInput = 314                    
        obexftp_sync() Done success=1                            
        done                                                     
        obexftp_setpath() Changing to brs                        
        Sending "brs"… obexftp_setpath() Setpath "brs"         
        cli_sync_request()                                       
        \obexftp_sync()
        client_done() 
        client_done: Warning: buffer still active?
        obexftp_sync() OBEX_HandleInput = 3      
        obexftp_sync() Done success=1            
        done                                     
        obexftp_get_type: Warning: buffer still active?
        Receiving "(null)"… obexftp_get_type() Getting (null) -> (null) (x-obex/folder-listing)
        cli_sync_request()                                                                      
        |obexftp_sync()
        client_done() 
        client_done: Warning: buffer still active?
        client_done() Found body (length: 291)   
        client_done: Warning: purging non-empty buffer.
        <?xml version="1.0"?>                         
        <!DOCTYPE folder-listing SYSTEM "obex-Folder-listing.dtd">
        <folder-listing version="1.0">                           
        <parent-folder />                                        
        <file name="private_login_data.dat" size="0" />          
        <file name="private_data.dat" size="2354" />             
        <folder name="hist" />                                   
        <folder name="bookmark" />                               
        </folder_listing>                                        
        client_done() Done body                                  
        client_done() Body not written                           
        obexftp_sync() OBEX_HandleInput = 297                    
        obexftp_sync() Done success=1                            
        done
        obexftp_setpath() Changing to hist
        Sending "hist"… obexftp_setpath() Setpath "hist"
        cli_sync_request()
        /obexftp_sync()
        cli_obex_event() OBEX_EV_REQDONE: obex_rsp=44
        client_done()
        client_done: Warning: buffer still active?
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=0
        failed: hist
        The operation failed with return code 68
        obexftp_get_type: Warning: buffer still active?
        Receiving "(null)"… obexftp_get_type() Getting (null) -> (null) (x-obex/folder-listing)
        cli_sync_request()
        -obexftp_sync()
        client_done()
        client_done: Warning: buffer still active?
        client_done() Found body (length: 253)
        client_done: Warning: purging non-empty buffer.
        <?xml version="1.0"?>
        <!DOCTYPE folder-listing SYSTEM "obex-Folder-listing.dtd">
        <folder-listing version="1.0">
        <parent-folder />
        <folder name="Other Files" />
        <folder name="Images" />
        <folder name="Sounds" />
        <folder name="Videos" />
        </folder_listing>
        client_done() Done body
        client_done() Body not written
        obexftp_sync() OBEX_HandleInput = 259
        obexftp_sync() Done success=1
        done
        obexftp_disconnect()
        Disconnecting…cli_sync_request()
        \obexftp_sync()
        client_done()
        client_done: Warning: buffer still active?
        obexftp_sync() OBEX_HandleInput = 3
        obexftp_sync() Done success=1
        done
        obexftp_close()
        obexftp_close: Warning: purging left-over buffer.

    Hopefully that's good enough to show you that I indeed am not crazy. This very well could be something with the phone trying to limit access.

    I got ObexFS to work, except I can't access any "non-default" files as I'll call it. The default on this phone are Images, Sounds, Other Files, and Videos, unless I change directory, then everything else is visible. Is there a way I can have obexfs issue a -c . command before it mounts the filesystem so I can have the other files listed?

     
  • That listing is very good to see the problem. There is a "hist" folder and you get a bad return code on setpath. If the phone tried to block you it should have sent rsp 43 (forbidden) but we see rsp 44 (not found). Strange. As you say obexfs should try to change to the top dir on connect. I'll add that asap.

     
  • Aaron Slunt
    Aaron Slunt
    2009-12-30

    Thanks, just lemme know when to start testing for you :)