Changeset 818
- Timestamp:
- Sep 27, 2013, 1:57:24 PM (12 years ago)
- Location:
- trunk/client/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/src/help/readme_fr.txt
r550 r818 251 251 252 252 Traduction franaise : Guillaume Gay <guillaume.gay@bigfoot.com> 253 Version : 201 0-01-11253 Version : 2012-01-21 -
trunk/client/src/ndpsmb.c
r800 r818 42 42 void fsphUnixTimeToDosDate( time_t time, FDATE* fdate, FTIME *ftime) 43 43 { 44 44 struct tm* gmt = localtime( &time); 45 45 #if 0 // as localtime() already does dst we don't need to add something 46 46 if (gmt->tm_isdst>0) { 47 47 debug_printf( "daylight saving in effect %d, timezone %d\n",gmt->tm_isdst, timezone); 48 48 time -= 3600; 49 49 gmt = localtime( &time); 50 50 } 51 51 #endif 52 53 54 55 56 57 52 fdate->day = gmt->tm_mday; 53 fdate->month = gmt->tm_mon+1; 54 fdate->year = gmt->tm_year + 1900 - 1980; 55 ftime->twosecs = gmt->tm_sec/2; 56 ftime->minutes = gmt->tm_min; 57 ftime->hours = gmt->tm_hour; 58 58 } 59 59 60 60 void fsphDosDateToUnixTime( FDATE fdate, FTIME ftime, ULONG* time) 61 61 { 62 63 64 debug_printf( "fsphDosDateToUnixTime time %02d:%02d\n", ftime.hours, ftime.minutes);65 66 67 68 69 70 71 72 73 74 62 struct tm gmtime = { 0 }; 63 64 debug_printf( "fsphDosDateToUnixTime time %02d:%02d:%02d\n", ftime.hours, ftime.minutes, ftime.twosecs*2); 65 gmtime.tm_mday = fdate.day; 66 gmtime.tm_mon = fdate.month-1; 67 gmtime.tm_year = fdate.year + 1980 - 1900; 68 gmtime.tm_sec = ftime.twosecs*2; 69 gmtime.tm_min = ftime.minutes; 70 gmtime.tm_hour = ftime.hours; 71 gmtime.tm_isdst = -1; // force libc to check dst saving 72 73 *time = mktime( &gmtime); 74 debug_printf( "fsphDosDateToUnixTime time1 %d %s", *time, ctime( (time_t*)time)); 75 75 #if 0 // as mktime() already does dst we don't need to add something 76 77 78 76 struct tm* gmt; 77 gmt = localtime( (time_t*) time); 78 if (gmt->tm_isdst>0) { 79 79 debug_printf( "fsphDosDateToUnixTime daylight saving in effect %d, timezone %d\n",gmt->tm_isdst, timezone); 80 80 *time += 3600; 81 } 81 } 82 debug_printf( "fsphDosDateToUnixTime time2 %d %s", *time, ctime( (time_t*)time)); 82 83 #endif 83 debug_printf( "fsphDosDateToUnixTime time2 %d %s", *time, ctime( (time_t*)time));84 84 } 85 85 … … 104 104 {ND_PROP_STRING, 0, "USER", "guest"}, 105 105 {ND_PROP_STRING, 0, "PASSWORD", ""}, 106 106 {ND_PROP_STRING, 0, "SPASSWORD", ""}, 107 107 {ND_PROP_STRING, 0, "MASTER", "WORKGROUP"}, 108 108 {ND_PROP_ULONG, 0, "MASTERTYPE", "1"}, 109 110 109 {ND_PROP_ULONG, 0, "CTO", "10"}, 110 {ND_PROP_ULONG, 0, "CLD", "32"}, 111 111 {ND_PROP_ULONG, 0, "EASUPPORT", "1"}, 112 112 {ND_PROP_STRING, 0, NULL, NULL} … … 126 126 /* A mutex to serialize plugin calls because libsmb may not be thread safe. */ 127 127 static NDMUTEX mutex; 128 128 129 129 static int lockInit (void) 130 130 { 131 132 } 133 131 return ph->fsphCreateMutex (&mutex); 132 } 133 134 134 static void lockClose (void) 135 135 { 136 137 } 138 136 ph->fsphCloseMutex (mutex); 137 } 138 139 139 static int lockRequest (void) 140 140 { 141 141 return ph->fsphRequestMutex (mutex, SEM_INDEFINITE_WAIT); 142 142 } 143 143 144 144 static void lockRelease (void) 145 145 { 146 146 ph->fsphReleaseMutex (mutex); 147 147 } 148 148 149 149 #if LIBSMB_THREAD_SAFE==0 150 150 151 #define ENTER() do { 152 int rcLock = lockRequest();\153 if (rcLock != NO_ERROR)\154 return rcLock;\151 #define ENTER() do { \ 152 int rcLock = lockRequest(); \ 153 if (rcLock != NO_ERROR) \ 154 return rcLock; \ 155 155 } while (0) 156 156 157 #define LEAVE() do { 158 lockRelease();\157 #define LEAVE() do { \ 158 lockRelease(); \ 159 159 } while (0) 160 160 … … 181 181 ifL = 1; 182 182 } 183 184 183 lockInit(); 184 debugInit(); 185 185 debuglocal(9,"Working with %s bit fileio NDFS\n", ifL ? "64" : "32"); 186 186 return NO_ERROR; … … 190 190 int APIENTRY NdpPluginFree (void) 191 191 { 192 193 192 debugDelete(); 193 lockClose(); 194 194 return NO_ERROR; 195 195 } … … 218 218 stat->attrFile = (finfo->attr & 0x37); 219 219 220 221 222 220 fsphUnixTimeToDosDate(finfo->mtime, &stat->fdateLastWrite, &stat->ftimeLastWrite); 221 fsphUnixTimeToDosDate(finfo->ctime, &stat->fdateCreation, &stat->ftimeCreation); 222 fsphUnixTimeToDosDate(finfo->atime, &stat->fdateLastAccess, &stat->ftimeLastAccess); 223 223 } 224 224 … … 248 248 stat.attrFile = (finfo->attr & 0x37); 249 249 250 251 252 250 fsphUnixTimeToDosDate(finfo->mtime, &stat.fdateLastWrite, &stat.ftimeLastWrite); 251 fsphUnixTimeToDosDate(finfo->ctime, &stat.fdateCreation, &stat.ftimeCreation); 252 fsphUnixTimeToDosDate(finfo->atime, &stat.fdateLastAccess, &stat.ftimeLastAccess); 253 253 debug_printf( "fname %s\n", finfo->fname); 254 254 debug_printf( "mtime %d %s", finfo->mtime, ctime( (time_t*)&finfo->mtime)); … … 261 261 static unsigned char fromhex (char c) 262 262 { 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 263 if ('0' <= c && c <= '9') 264 { 265 return c - '0'; 266 } 267 268 if ('A' <= c && c <= 'F') 269 { 270 return c - 'A' + 0xA; 271 } 272 273 if ('a' <= c && c <= 'f') 274 { 275 return c - 'a' + 0xA; 276 } 277 278 return 0; 279 279 } 280 280 281 281 static char tohex (unsigned char b) 282 282 { 283 284 285 286 287 288 289 290 283 b &= 0xF; 284 285 if (b <= 9) 286 { 287 return b + '0'; 288 } 289 290 return 'A' + (b - 0xA); 291 291 } 292 292 293 293 static void decryptPassword (const char *pszCrypt, char *pszPlain) 294 294 { 295 296 297 298 299 300 301 302 303 304 295 /* A simple "decryption", character from the hex value. */ 296 const char *s = pszCrypt; 297 char *d = pszPlain; 298 299 while (*s) 300 { 301 *d++ = (char)((fromhex (*s++) << 4) + fromhex (*s++)); 302 } 303 304 *d++ = 0; 305 305 } 306 306 307 307 static void encryptPassword (const char *pszPlain, char *pszCrypt) 308 308 { 309 310 311 312 313 314 315 316 317 318 319 320 309 /* A simple "encryption" encode each character as hex value. */ 310 const char *s = pszPlain; 311 char *d = pszCrypt; 312 313 while (*s) 314 { 315 *d++ = tohex ((*s) >> 4); 316 *d++ = tohex (*s); 317 s++; 318 } 319 320 *d++ = 0; 321 321 } 322 322 … … 338 338 pRes->krb5support = 0; 339 339 #endif 340 340 pRes->pdc = NULL; 341 341 342 342 t = 0, q = NULL; … … 380 380 381 381 t = 0, q = NULL; 382 rc = ph->fsphQueryStringProperty (properties, "SPASSWORD", &q, &t); 383 if ( rc == NO_ERROR 384 && *q != '\0' 385 && defaultPassword) 386 { 387 char p[1024]; 388 p[0] = 0; 389 390 decryptPassword (q, p); 391 392 if (*p) 393 { 394 strncpy(pRes->srv.password, p, sizeof(pRes->srv.password) - 1); 395 396 /* clear the plain password */ 397 ph->fsphSetProperty (properties, "PASSWORD", ""); 398 } 399 } 400 else 401 { 402 char c[1024]; 403 encryptPassword (pRes->srv.password, c); 404 405 ph->fsphSetProperty (properties, "SPASSWORD", c); 406 407 // clear the plain password 408 ph->fsphSetProperty (properties, "PASSWORD", ""); 409 } 382 rc = ph->fsphQueryStringProperty (properties, "SPASSWORD", &q, &t); 383 if ( rc == NO_ERROR && *q != '\0' && defaultPassword) 384 { 385 char p[1024]; 386 p[0] = 0; 387 388 decryptPassword (q, p); 389 390 if (*p) 391 { 392 strncpy(pRes->srv.password, p, sizeof(pRes->srv.password) - 1); 393 394 /* clear the plain password */ 395 ph->fsphSetProperty (properties, "PASSWORD", ""); 396 } 397 } 398 else 399 { 400 char c[1024]; 401 encryptPassword (pRes->srv.password, c); 402 403 ph->fsphSetProperty (properties, "SPASSWORD", c); 404 405 // clear the plain password 406 ph->fsphSetProperty (properties, "PASSWORD", ""); 407 } 410 408 411 409 t = 0, q = NULL; … … 473 471 474 472 /* 475 476 477 473 * Create a directory cache with expiration time and cache listings 474 * the above values come from the gui. default: timeout 10; listings: 32 475 */ 478 476 dircache_create(&pRes->pdc, pRes->cachetimeout, pRes->cachedepth); 479 477 … … 580 578 if (newlevel) 581 579 { 582 580 // reconnect to server here, first test new connection 583 581 cli_state* tmp_cli = NULL; 584 582 rc = smbwrp_connect( &tmpRes, &tmp_cli); … … 615 613 rc = smbwrp_connect( pRes, &cli); 616 614 /* changed to real error codes SCS 617 618 615 if (rc) 616 rc = (rc == 7 ? ERROR_BAD_DEV_TYPE : ERROR_ACCESS_DENIED); */ 619 617 switch (rc) { 620 618 case 0: … … 682 680 // nd/ndpm do not use main thread 683 681 if (!rc && _gettid()!=1) 684 682 rc = checkMountResource( pRes); 685 683 if (!rc) 686 684 { … … 812 810 if (rc) 813 811 { 814 815 816 817 818 819 820 821 812 debuglocal(9,"NdpCreateConnection failed rc=%d\n", rc); 813 pfsa->cSectorUnit = 1; 814 pfsa->cUnit = 123456; 815 pfsa->cUnitAvail = 123456; 816 pfsa->cbSector = 2048; 817 rc = (rc == 7 ? ERROR_BAD_DEV_TYPE : ERROR_ACCESS_DENIED); 818 LEAVE(); 819 return rc; 822 820 } 823 821 … … 918 916 /* 919 917 * NdpQueryPathInfo is the most important function :) netdrive always calls 920 * the function before every operation to find out the path status: does it exist, is it a file, does a921 * parent directory exist, etc.918 * the function before every operation to find out the path status: 919 * does it exist, is it a file, does a parent directory exist, etc. 922 920 * Plugin must return one of the following error codes: 923 * NO_ERROR - path exists and the path information have been successfully retrieved. 921 * NO_ERROR - path exists and the path information have been successfully 922 * retrieved. 924 923 * ERROR_FILE_NOT_FOUND - all but the last component of the path exist and the 925 * 926 * 927 * 924 * path without the last component is a directory. dir1_ok\dir2_ok\does_not_exist. 925 * the wildcard can not exist, so the plugin returns FILE_NOT_FOUND, if the parent 926 * directory exist. 928 927 * ERROR_PATH_NOT_FOUND - any of not last path components does not exist, or all 929 * 928 * but the last component exist and is a file: \dir_ok\dir2_ok\file_ok\non_existing. 930 929 * ERROR_REM_NOT_LIST - resource is temporarily unavailable for some reasons. 931 930 * Any other error codes means an internal plugin error, not related to the status … … 997 996 if (rc == ERROR_REM_NOT_LIST) 998 997 { 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 998 // free current cli resources 999 smbwrp_disconnect( pRes, pConn->cli); 1000 // reconnect 1001 rcCon = smbwrp_connect( pRes, &pConn->cli); 1002 if (rcCon != NO_ERROR) 1003 debuglocal(9,"NdpQueryPathInfo smbwrp_connect rc = %d\n", rcCon); 1004 1005 // try file list again if reconnecting worked 1006 if (rcCon == NO_ERROR) 1007 rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo); 1009 1008 } 1010 1009 debuglocal(9,"NdpQueryPathInfo smbwrp_getattr, rc = %d\n", rc); … … 1037 1036 *p = 0; 1038 1037 rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo); 1039 1038 debuglocal(9,"NdpQueryPathInfo upper path in <%s>, rc = %d\n", finfo.fname, rc); 1040 1039 if (rc == NO_ERROR) 1041 1040 { 1042 rc = (finfo.attr & FILE_DIRECTORY) !=0 ? 1043 ERROR_FILE_NOT_FOUND: 1044 ERROR_PATH_NOT_FOUND; 1041 rc = (finfo.attr & FILE_DIRECTORY) !=0 ? 1042 ERROR_FILE_NOT_FOUND:ERROR_PATH_NOT_FOUND; 1045 1043 } 1046 1047 1048 1044 else if (rc != ERROR_REM_NOT_LIST) 1045 { 1046 rc = ERROR_PATH_NOT_FOUND; 1049 1047 } 1050 1048 } … … 1133 1131 } 1134 1132 debuglocal(9,"NdpFindStart: dir [%s], dir_mask [%s], mask [%s], szPath [%s]\n", 1135 1133 state.dir, state.dir_mask, state.mask, state.fullpath); 1136 1134 rc = smbwrp_filelist( &pRes->srv, pConn->cli, &state); 1137 1135 // we need to handle reconnection also here, because NdpQueryPathInfo … … 1139 1137 if (rc == ERROR_REM_NOT_LIST) 1140 1138 { 1141 1142 1143 1144 1145 1146 1147 1139 // free current cli resources 1140 smbwrp_disconnect( pRes, pConn->cli); 1141 // reconnect 1142 smbwrp_connect( pRes, &pConn->cli); 1143 // try file list again next loop 1144 rc = smbwrp_filelist( &pRes->srv, pConn->cli, &state); 1145 debuglocal(9,"NdpFindStart remote connection lost, rc = %d\n", rc); 1148 1146 } 1149 1147 … … 1167 1165 int APIENTRY NdpDiscardResourceData (HRESOURCE resource, NDDATABUF *pdatabuf) 1168 1166 { 1169 1170 1171 1172 1173 1167 // The plugin do not have to deallocate anything 1168 // because resource data did not contain any pointers 1169 // to plugins data. 1170 // Data stored by fsphSetResourceData will be 1171 // deallocated by NetDrive. 1174 1172 1175 1173 debuglocal(9,"NdpDicardresourceData %d\n", 0); … … 1190 1188 debug_printf("NdpSetPathInfo in [%p]\n", pConn); 1191 1189 1192 1190 // delete the dir cache 1193 1191 dircache_invalidate(szPathName, pRes->pdc, 1); 1194 1192 … … 1306 1304 debuglocal(9,"NdpEAQuery in [%p] <%s> %08x %d\n", pConn, path, pGEAList, pGEAList ? pGEAList->cbList : 0); 1307 1305 1308 1309 1310 1311 1312 1313 1306 char *pchBuffer = (char *)malloc(cbBuffer); 1307 if (!pchBuffer) 1308 { 1309 LEAVE(); 1310 return ERROR_NOT_ENOUGH_MEMORY; 1311 } 1314 1312 1315 1313 do { … … 1342 1340 } 1343 1341 } while (0); 1344 1342 free(pchBuffer); 1345 1343 debuglocal(9,"NdpEAQuery <%s> %d %d %d\n", pfi->pszName, rc, pFEASrc->cbList, pFEAList->cbList); 1346 1344 LEAVE(); … … 1423 1421 return ERROR_EAS_NOT_SUPPORTED; 1424 1422 } 1425 1426 debuglocal(9, "remove me NdpEASize before fsphGetFileInfoData\n"); 1423 1427 1424 rc = ph->fsphGetFileInfoData(pfi, &fdata, 0); 1428 1425 if (rc || !fdata.ulSize || !fdata.pData) … … 1434 1431 ENTER(); 1435 1432 1436 debuglocal(9, "remove me NdpEASize before finfo =\n");1437 1433 finfo = (smbwrp_fileinfo *)fdata.pData; 1438 debuglocal(9, "remove me NdpEASize after finfo=\n");1439 1434 easize = finfo->easize; 1440 1435 finfo->easize = -1; … … 1450 1445 debuglocal(9,"NdpEASize in [%p] <%s> \n", pConn, path); 1451 1446 1452 1453 1454 1455 1456 1457 1447 char *pchBuffer = (char *)malloc(cbBuffer); 1448 if (!pchBuffer) 1449 { 1450 LEAVE(); 1451 return ERROR_NOT_ENOUGH_MEMORY; 1452 } 1458 1453 1459 1454 do { … … 1482 1477 *pulEASize = pfealist->cbList; 1483 1478 } while (0); 1484 1479 free(pchBuffer); 1485 1480 debuglocal(9,"NdpEASize <%s> %d %d\n", pfi->pszName, *pulEASize, rc); 1486 1481 LEAVE(); … … 1792 1787 int APIENTRY NdpIOCTL (int type, HRESOURCE resource, char *path, int function, void *in, ULONG insize, PULONG poutlen) 1793 1788 { 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 char out[4096];1806 sprintf (out, "SAMBA IOCTL function = %d, parms [%s] insize = %d, *poutlen = %d", function, in, insize, *poutlen);1807 *poutlen = strlen(out);1808 strcpy (in, out);1809 return NO_ERROR;1810 1811 1812 1789 if (function == ND_PL_INIT_THREAD) 1790 { 1791 smbwrp_initthread(); 1792 debuglocal(9, "NdpIOCTL init thread\n"); 1793 return NO_ERROR; 1794 } 1795 1796 debuglocal(9,"NdpIOCTL <%s> %d\n", path, function); 1797 1798 if (in && insize > 4096) 1799 { 1800 char out[4096]; 1801 sprintf (out, "SAMBA IOCTL function = %d, parms [%s] insize = %d, *poutlen = %d", function, in, insize, *poutlen); 1802 *poutlen = strlen(out); 1803 strcpy (in, out); 1804 return NO_ERROR; 1805 } 1806 1807 return ERROR_NOT_SUPPORTED; 1813 1808 } 1814 1809 … … 1863 1858 debuglocal(9,"NdpFileEAQuery in [%p] <%s>/%d pGEAList=%08x\n", pConn, pConn->file.fname, pConn->file.fd, pGEAList); 1864 1859 1865 1866 1867 1860 char *pchBuffer = (char *)malloc(cbBuffer); 1861 if (!pchBuffer) 1862 return ERROR_NOT_ENOUGH_MEMORY; 1868 1863 1869 1864 ENTER(); … … 1903 1898 } 1904 1899 } while (0); 1905 1900 free(pchBuffer); 1906 1901 debuglocal(9,"NdpFileEAQuery out <%s>/%d pFEASrc->cbList=%d pFEAList->cbList=%d rc=%d\n", pConn->file.fname, pConn->file.fd, pFEASrc->cbList, pFEAList->cbList, rc); 1907 1902 LEAVE(); … … 1978 1973 debuglocal(9,"NdpFileEASize in [%p] <%s>/%d \n", pConn, pConn->file.fname, pConn->file.fd); 1979 1974 1980 1981 1982 1975 char *pchBuffer = (char *)malloc(cbBuffer); 1976 if (!pchBuffer) 1977 return ERROR_NOT_ENOUGH_MEMORY; 1983 1978 1984 1979 ENTER(); … … 2014 2009 *pulEASize = pFEAList->cbList; 2015 2010 } while (0); 2016 2011 free(pchBuffer); 2017 2012 debuglocal(9,"NdpFileEASize %d %d\n", *pulEASize, rc); 2018 2013 LEAVE(); … … 2031 2026 debug_printf("NdpFileSetInfo in [%p]\n", pConn); 2032 2027 2033 2028 // delete the dir cache 2034 2029 dircache_invalidate(pConn->file.fullname, pRes->pdc, 1); 2035 2030 … … 2044 2039 pConn->file.openattr = attrFile; 2045 2040 fsphDosDateToUnixTime(pfi->stat.fdateLastWrite, pfi->stat.ftimeLastWrite, &(pConn->file.mtime)); 2041 fsphDosDateToUnixTime(pfi->stat.fdateCreation, pfi->stat.ftimeCreation, &(pConn->file.ctime)); 2042 pConn->file.updatetime = 2; 2046 2043 debug_printf("NdpFileSetInfo mtime %d\n", pConn->file.mtime); 2047 2044 } while (0); … … 2180 2177 while (ulReadCompleted < ulRead) 2181 2178 { 2182 2179 ULONG ulActual; 2183 2180 ULONG ulToRead = ulRead - ulReadCompleted; 2184 2181 debuglocal(9,"NdpFileRead completed %d, to read %d\n", ulReadCompleted, ulToRead); … … 2227 2224 debuglocal(9,"NdpFileWrite in [%p]\n", pConn); 2228 2225 2229 2230 2231 2232 2226 /* delete the dir cache 2227 this was moved from NdpFileClose() becasue if there are a lot files in the tree all are reread 2228 the problem when moved to here is, that last accessed time is not refreshed 2229 if this is needed, a new function needs to be done to update only one file in the cache */ 2233 2230 dircache_invalidate(pConn->file.fullname, pRes->pdc, 1); 2234 2231 -
trunk/client/src/nversion.tpl
r756 r818 6 6 #define NDPSMB_BUILD _BUILD_ 7 7 #define NDPSMB_INSTALL _WPIVERSION_ 8 #define VERSION 8 #define VERSION "_VERSION_" 9 9 #define BUILD "_BUILD_" 10 10 #define OS eCS (OS/2) -
trunk/client/src/smbwrp.c
r808 r818 39 39 static int 40 40 net_share_enum_rpc(struct cli_state *cli, 41 42 43 44 45 41 void (*fn)(const char *name, 42 uint32 type, 43 const char *comment, 44 void *state), 45 void *state) 46 46 { 47 47 int i; … … 78 78 info_ctr.ctr.ctr1 = &ctr1; 79 79 status = rpccli_srvsvc_NetShareEnumAll(pipe_hnd, mem_ctx, 80 81 82 83 84 85 80 pipe_hnd->desthost, 81 &info_ctr, 82 0xffffffff, 83 &total_entries, 84 &resume_handle, 85 &werr); 86 86 87 87 /* Was it successful? */ … … 128 128 char slogfilename[] = "log.smbc"; 129 129 char *env = getenv("LOGFILES"); 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 130 if (env != NULL) 131 { 132 strncpy(slogfile, env, sizeof(slogfile) -1); 133 strncat(slogfile, "\\", sizeof(slogfile) - strlen(slogfile) -1); 134 strncat(slogfile, slogfilename, sizeof(slogfile) - strlen(slogfile) -1); 135 } 136 else 137 { 138 strncpy(slogfile, slogfilename, sizeof(slogfile) -1); 139 } 140 141 // init samba for debug messages 142 setup_logging(slogfile, false); 143 lp_set_logfile(slogfile); 144 debug_parse_levels("10"); 145 145 146 146 } … … 201 201 { 202 202 /* 203 *Block SIGPIPE (from lib/util_sock.c: write())204 *It is not needed and should not stop execution205 203 Block SIGPIPE (from lib/util_sock.c: write()) 204 It is not needed and should not stop execution 205 */ 206 206 BlockSignals(True, SIGPIPE); 207 207 } … … 316 316 char *rparam=NULL, *rdata=NULL; 317 317 char *p; 318 318 319 319 param = SMB_MALLOC_ARRAY(char, 6+nlen+2); 320 320 if (!param) { … … 331 331 332 332 if (!cli_send_trans(cli, SMBtrans2, 333 NULL,/* name */334 -1, 0,/* fid, flags */335 &setup, 1, 0,/* setup, length, max */336 param, param_len, 10,/* param, length, max */337 NULL, data_len, cli->max_xmit/* data, length, max */338 333 NULL, /* name */ 334 -1, 0, /* fid, flags */ 335 &setup, 1, 0, /* setup, length, max */ 336 param, param_len, 10, /* param, length, max */ 337 NULL, data_len, cli->max_xmit /* data, length, max */ 338 )) { 339 339 return False; 340 340 } … … 342 342 SAFE_FREE(param); 343 343 if (!cli_receive_trans(cli, SMBtrans2, 344 345 344 &rparam, ¶m_len, 345 &rdata, &data_len)) { 346 346 return False; 347 347 } … … 402 402 403 403 if (!cli_send_trans(cli, SMBtrans2, 404 NULL,/* name */405 -1, 0,/* fid, flags */406 &setup, 1, 0,/* setup, length, max */407 param, param_len, 2,/* param, length, max */408 NULL, data_len, cli->max_xmit/* data, length, max */409 404 NULL, /* name */ 405 -1, 0, /* fid, flags */ 406 &setup, 1, 0, /* setup, length, max */ 407 param, param_len, 2, /* param, length, max */ 408 NULL, data_len, cli->max_xmit /* data, length, max */ 409 )) { 410 410 return False; 411 411 } 412 412 413 413 if (!cli_receive_trans(cli, SMBtrans2, 414 415 414 &rparam, ¶m_len, 415 &rdata, &data_len)) { 416 416 return False; 417 417 } … … 635 635 } 636 636 file->fd = fd; 637 file-> newmtime = 0;637 file->updatetime = 0; 638 638 file->offset = 0; 639 639 return 0; … … 686 686 } 687 687 688 file-> newmtime = 1;688 file->updatetime = 1; 689 689 file->offset += ret; 690 690 *result = ret; … … 703 703 } 704 704 705 debuglocal(4,"smpwrp_close updatetime: %d\n", file->updatetime); 706 707 if (file->updatetime == 1) 708 { 709 file->mtime = time(NULL); 710 debuglocal(4,"cli_close new mtime %lu\n", file->mtime); 711 } 705 712 706 713 if (!NT_STATUS_IS_OK(cli_close(cli, file->fd))) 707 714 { 708 return os2cli_errno(cli); 709 } 710 if (file->newmtime) 711 { 712 file->newmtime = 0; 713 file->mtime = time(NULL); 714 debuglocal(4,"cli_close new mtime %lu\n", file->mtime); 715 } 715 rc = os2cli_errno(cli); 716 } 717 718 if (!rc && (file->openattr || file->mtime || file->ctime)) 719 { 720 debuglocal(4,"Set pathinfo on close %s %08x %d %d\n", file->fname, file->openattr, file->mtime, file->ctime); 721 if (!NT_STATUS_IS_OK(cli_setpathinfo(cli, file->fname, file->ctime, 0, file->mtime, 0, file->openattr))) 722 { 723 debuglocal(4,"Set pathinfo on close failed %d\n", os2cli_errno(cli)); 724 //rc = os2cli_errno(cli); 725 } 726 } 727 728 file->openattr = 0; 729 file->mtime = 0; 730 file->ctime = 0; 731 file->updatetime = 0; 716 732 file->fd = -1; 717 733 file->offset = 0; 718 if (file->openattr || file->mtime)719 {720 debuglocal(4,"Set attr on close %s %08x %d %d\n", file->fname, file->openattr, file->mtime, file->mtime);721 if (!NT_STATUS_IS_OK(cli_setatr(cli, file->fname, file->openattr, file->mtime)))722 {723 debuglocal(4,"Set attr on close failed %d\n", os2cli_errno(cli));724 //rc = os2cli_errno(cli);725 }726 727 file->openattr = 0;728 file->mtime = 0;729 }730 734 *file->fname = 0; 731 735 return rc; -
trunk/client/src/smbwrp.h
r808 r818 91 91 int denymode; 92 92 unsigned long mtime; 93 int newmtime; 93 unsigned long ctime; 94 int updatetime; 95 // 0 = time is not updated upon file close 96 // 1 = modified time is updated to current time 97 // 2 = create and modified time are updated according local file 94 98 char fullname[261]; 95 99 char fname[261];
Note:
See TracChangeset
for help on using the changeset viewer.