Changeset 150
- Timestamp:
- Aug 20, 2008, 2:29:02 PM (17 years ago)
- Location:
- branches/client-1.5/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/client-1.5/src/ndpsmb.c
r147 r150 856 856 pfsa->cUnitAvail = 123456; 857 857 pfsa->cbSector = 2048; 858 rc = (rc == 7 ? ERROR_BAD_DEV_TYPE : ERROR_ACCESS_DENIED); 858 859 return rc; 859 860 } … … 913 914 free(pConn); 914 915 pConn = NULL; 916 rc = (rc == 7 ? ERROR_BAD_DEV_TYPE : ERROR_INVALID_PARAMETER); 915 917 } 916 918 … … 944 946 // ------------------------------------------------------------- 945 947 948 /* 949 * NdpQueryPathInfo is the most important function :) netdrive always calls 950 * the function before every operation to find out the path status: does it exist, is it a file, does a 951 * parent directory exist, etc. 952 * Plugin must return one of the following error codes: 953 * NO_ERROR - path exists and the path information have been successfully retrieved. 954 * ERROR_FILE_NOT_FOUND - all but the last component of the path exist and the 955 * path without the last component is a directory. dir1_ok\dir2_ok\does_not_exist. 956 * the wildcard can not exist, so the plugin returns FILE_NOT_FOUND, if the parent 957 * directory exist. 958 * ERROR_PATH_NOT_FOUND - any of not last path components does not exist, or all 959 * but the last component exist and is a file: \dir_ok\dir2_ok\file_ok\non_existing. 960 * ERROR_REM_NOT_LIST - resource is temporarily unavailable for some reasons. 961 * Any other error codes means an internal plugin error, not related to the status 962 * of the path queried. 963 */ 946 964 int APIENTRY NdpQueryPathInfo (HCONNECTION conn, void *plist, char *szPath) 947 965 { … … 954 972 int retry = 0; 955 973 956 do957 {958 974 log("NdpQueryPathInfo in <%s>, retry = %d\n", szPath, retry); 975 976 // is wildcard is specified, we suppose parent dir exist, so exit immediately 977 if (ph->fsphStrChr(szPath, '*') || ph->fsphStrChr(szPath, '?')) 978 { 979 return ERROR_FILE_NOT_FOUND; 980 } 981 959 982 960 983 do { 961 962 if (ph->fsphStrChr(szPath, '*') || ph->fsphStrChr(szPath, '?'))963 {964 rc = ERROR_FILE_NOT_FOUND;965 break;966 }967 984 968 985 rc = pathparser(pRes, pConn, szPath, path); … … 992 1009 if (rc) 993 1010 { 1011 // remote server not available for first time? 1012 if (rc == ERROR_REM_NOT_LIST && retry == 0) 1013 { 1014 // free current cli resources 1015 smbwrp_disconnect( pRes, pConn->cli); 1016 // reconnect 1017 smbwrp_connect( pRes, &pConn->cli); 1018 // try file list again 1019 rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo); 1020 log("NdpQueryPathInfo remote connection lost, retry rc = %d\n", rc); 1021 } 994 1022 switch (rc) 995 1023 { … … 999 1027 case ERROR_ACCESS_DENIED: 1000 1028 case ERROR_INVALID_PARAMETER: 1029 case ERROR_REM_NOT_LIST: 1001 1030 break; 1002 1031 default : … … 1005 1034 } 1006 1035 } 1007 rc =rc ? rc : ERROR_INVALID_PARAMETER;1008 1036 } 1009 1037 else … … 1022 1050 if (rc) 1023 1051 { 1024 rc = rc ? ERROR_PATH_NOT_FOUND : ERROR_INVALID_PARAMETER; 1052 log("NdpQueryPathInfo upper path in <%s>, retry = %d\n", finfo.fname, retry); 1053 rc = rc ? ERROR_PATH_NOT_FOUND : ERROR_INVALID_PARAMETER; 1025 1054 } 1026 1055 } … … 1028 1057 } while (0); 1029 1058 log("NdpQueryPathInfo <%s> (%s) %d\n", szPath, path, rc); 1030 retry = rc && !retry; 1031 1032 } while (retry); 1033 1059 1034 1060 return rc; 1035 1061 } … … 1096 1122 } 1097 1123 rc = smbwrp_filelist( &pRes->srv, pConn->cli, &state); 1124 // we need to handle reconnection also here, because NdpQueryPathInfo 1125 // could be called with '*' and exit then immediately (without calling libsmb) 1126 if (rc == ERROR_REM_NOT_LIST) 1127 { 1128 // free current cli resources 1129 smbwrp_disconnect( pRes, pConn->cli); 1130 // reconnect 1131 smbwrp_connect( pRes, &pConn->cli); 1132 // try file list again next loop 1133 rc = smbwrp_filelist( &pRes->srv, pConn->cli, &state); 1134 log("NdpFindStart remote connection lost, retry rc = %d\n", rc); 1135 } 1098 1136 1099 1137 log("NdpFindStart <%s> (%s) cnt %d %d\n", szPath, path, count, rc); -
branches/client-1.5/src/smbwrp.c
r147 r150 1 1 2 #include "includes.h" 2 3 … … 95 96 if (cli->fd == -1) 96 97 { 97 return ENOTCONN;98 return maperror( ENOTCONN); 98 99 } 99 100 return maperror(cli_errno(cli)); … … 495 496 496 497 debuglocal(4," tconx ok. cli caps %08x\n", c->capabilities); 497 498 498 499 // save cli_state pointer 499 500 *cli = c;
Note:
See TracChangeset
for help on using the changeset viewer.