Changeset 960
- Timestamp:
- Aug 16, 2016, 5:41:49 PM (9 years ago)
- Location:
- trunk/client/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/src/debug.c
r959 r960 31 31 #include <sys/stat.h> 32 32 #include "nversion.h" 33 #include "smbwrp.h" 33 34 34 int debuglevel = 9; // we set it to 9, so we get all messages 35 char logfile[_MAX_PATH +1]; 36 char debugfile[_MAX_PATH +1]; 37 char logfilename[] = "log.ndpsmb"; 38 BOOL do_logging; 39 BOOL firstLogLine; 40 HMTX logMutex; 41 char nameMutex[] = "\\SEM32\\NDPSMB"; 35 void debugInit(Resource *pRes, char *logfileext, int ifL) 36 { 37 if (!pRes) 38 return; 42 39 43 int debuglvl(int level) 44 { 45 return (level <= debuglevel) ? 1 : 0; 46 } 47 48 BOOL writeLog() 49 { 50 return do_logging; 51 } 52 53 void debugInit() 54 { 55 *logfile = '\0'; 56 *debugfile = '\0'; 57 do_logging = FALSE; 58 firstLogLine = TRUE; 59 logMutex = NULLHANDLE; 60 struct stat filestat; 40 pRes->firstLogLine = 1; 41 pRes->ifL = ifL; 61 42 APIRET rc = NO_ERROR; 62 63 // create the debugfile name64 strncat(debugfile, getenv("ETC"), 2);65 strncat(debugfile, "\\", sizeof(debugfile) - strlen(debugfile) -1);66 strncat(debugfile, "ndpsmb.dbg", sizeof(debugfile) - strlen(debugfile) -1);67 68 // is the file around? if not we have no debug69 if (stat(debugfile, &filestat) !=0)70 return;71 43 72 44 //create the logfile variable … … 74 46 if (env != NULL) 75 47 { 76 strncat(logfile, env, sizeof(logfile) -1); 77 strncat(logfile, "\\", sizeof(logfile) - strlen(logfile) -1); 78 strncat(logfile, logfilename, sizeof(logfile) - strlen(logfile) -1); 48 snprintf(pRes->logfile, sizeof(pRes->logfile), "%s/%s.%s", env, "log.ndpsmb", logfileext); 49 snprintf(pRes->smb_logfile, sizeof(pRes->smb_logfile), "%s/%s.%s", env, "log.smbc", logfileext); 79 50 } 80 51 else 81 strncat(logfile, logfilename, sizeof(logfile) -1); 82 83 // set the samba logging stuff 84 do_logging = TRUE; 85 86 // now we create a sem, so that logging from different threads works 87 rc = DosCreateMutexSem(nameMutex, &logMutex, 0, FALSE); 88 if (rc == ERROR_DUPLICATE_NAME) 89 rc = DosOpenMutexSem(nameMutex, &logMutex); 52 { 53 snprintf(pRes->logfile, sizeof(pRes->logfile), "%s.%s", "log.ndpsmb", logfileext); 54 snprintf(pRes->smb_logfile, sizeof(pRes->smb_logfile), "%s.%s", "log.smbc", logfileext); 55 } 56 pRes->logfileFH = NULL; 90 57 91 58 return; … … 94 61 void debugDelete() 95 62 { 96 DosCloseMutexSem(logMutex);97 63 return; 98 64 } 99 65 100 void debug local(int level, const char * fmt, ...)66 void debugClose(Resource *pRes) 101 67 { 102 FILE *f=NULL; 68 if (pRes && pRes->logfileFH) 69 { 70 fclose(pRes->logfileFH); 71 pRes->logfileFH = NULL; 72 } 73 return; 74 } 103 75 76 void debuglocal(Resource *pRes, int level, const char * fmt, ...) 77 { 78 FILE *f = NULL; 104 79 // do we have to log at all 105 if ( !do_logging)80 if (pRes && (level > pRes->loglevel)) 106 81 return; 107 108 // if the sem is created we request it109 if (logMutex)110 DosRequestMutexSem(logMutex, (ULONG) SEM_INDEFINITE_WAIT);111 82 112 83 do { … … 114 85 char buf[80] = {0}; 115 86 va_list args; 116 if ( logfile[0])87 if (pRes) 117 88 { 118 f = fopen(logfile, "a"); 119 if (!f) 89 if (!pRes->logfileFH) 90 pRes->logfileFH = fopen(pRes->logfile, "a"); 91 if (!pRes->logfileFH) 120 92 break; 93 else 94 f = pRes->logfileFH; 121 95 } 122 96 else … … 124 98 125 99 // in the first log line we write our version of the client 126 if ( firstLogLine)100 if (pRes && pRes->firstLogLine) 127 101 { 128 102 fprintf(f, "Samba client %s build %s based on %s\n", VERSION, BUILD, smbwrp_getVersion()); 129 103 fprintf(f, "This build is maintained by %s\n", VENDOR); 130 firstLogLine = FALSE; 104 fprintf(f, "Working with %s bit fileio NDFS\n", pRes->ifL ? "64" : "32"); 105 106 pRes->firstLogLine = 0; 131 107 } 132 108 … … 137 113 vfprintf(f, fmt, args); 138 114 va_end(args); 139 if (logfile)140 fclose(f);141 115 142 116 } while (0); 143 117 144 // if the sem is created we release it145 if (logMutex)146 DosReleaseMutexSem(logMutex);147 148 118 return; 149 119 } -
trunk/client/src/dircache.c
r958 r960 109 109 110 110 111 static int dceCreate (DirectoryCacheEntry **ppdce, DirectoryCache *pdc, const char *path, int cFiles)111 static int dceCreate (DirectoryCacheEntry **ppdce, Resource *pRes, const char *path, int cFiles) 112 112 { 113 113 DirectoryCacheEntry *pdce = (DirectoryCacheEntry *)malloc(sizeof(DirectoryCacheEntry)); … … 128 128 pdce->ulHash = computehash (path); 129 129 pdce->ulLastUpdateTime = 0; 130 pdce->pdc = p dc;130 pdce->pdc = pRes->pdc; 131 131 pdce->fInvalid = 0; 132 132 … … 155 155 } 156 156 157 static void dceWriteEntry ( DirectoryCacheEntry *pdce, const smbwrp_fileinfo *finfo)157 static void dceWriteEntry (Resource *pRes, DirectoryCacheEntry *pdce, const smbwrp_fileinfo *finfo) 158 158 { 159 159 if (pdce->cInfos >= pdce->cInfosAllocated) … … 165 165 cNewAllocated * sizeof (smbwrp_fileinfo)); 166 166 167 debuglocal( 9, "dceWriteEntry: [%s] realloc %d -> %d\n", pdce->pszPath, pdce->cInfosAllocated, cNewAllocated);167 debuglocal(pRes, 9, "dceWriteEntry: [%s] realloc %d -> %d\n", pdce->pszPath, pdce->cInfosAllocated, cNewAllocated); 168 168 if (pNewInfos) 169 169 { … … 183 183 } 184 184 185 static void dceAdjust ( DirectoryCacheEntry *pdce)185 static void dceAdjust (Resource *pRes, DirectoryCacheEntry *pdce) 186 186 { 187 187 /* If the entry has too many preallocated info structures, adjust the memory allocation */ … … 196 196 cNewAllocated * sizeof (smbwrp_fileinfo)); 197 197 198 debuglocal( 9, "dceAdjust: [%s] realloc %d -> %d\n", pdce->pszPath, pdce->cInfosAllocated, cNewAllocated);198 debuglocal(pRes, 9, "dceAdjust: [%s] realloc %d -> %d\n", pdce->pszPath, pdce->cInfosAllocated, cNewAllocated); 199 199 if (pNewInfos) 200 200 { … … 209 209 } 210 210 211 static int dcePathEqualsTo ( DirectoryCacheEntry *pdce, const char *path)212 { 213 debuglocal( 9, "dcePathEqualTo: [%s] [%s]\n", path, pdce->pszPath);211 static int dcePathEqualsTo (Resource *pRes, DirectoryCacheEntry *pdce, const char *path) 212 { 213 debuglocal(pRes, 9, "dcePathEqualTo: [%s] [%s]\n", path, pdce->pszPath); 214 214 return ph->fsphStrICmp (path, pdce->pszPath) == 0; 215 215 } … … 225 225 } 226 226 227 static struct DirectoryCacheEntry *dcFindDirCache ( struct DirectoryCache *pdc, const char *path, int fPrefix)227 static struct DirectoryCacheEntry *dcFindDirCache (Resource *pRes, const char *path, int fPrefix) 228 228 { 229 229 unsigned long hash = computehash (path); 230 230 231 DirectoryCacheEntry *iter = p dc->pEntriesHead;232 233 debuglocal( 9, "findDirCache: [%s]\n", path);231 DirectoryCacheEntry *iter = pRes->pdc->pEntriesHead; 232 233 debuglocal(pRes, 9, "findDirCache: [%s]\n", path); 234 234 235 235 while (iter != NULL) 236 236 { 237 debuglocal( 9, "findDirCache: entry [%s]\n", iter->pszPath);237 debuglocal(pRes, 9, "findDirCache: entry [%s]\n", iter->pszPath); 238 238 if (fPrefix) 239 239 { … … 246 246 { 247 247 if ( iter->ulHash == hash 248 && dcePathEqualsTo ( iter, path)248 && dcePathEqualsTo (pRes, iter, path) 249 249 ) 250 250 { … … 255 255 } 256 256 257 debuglocal( 9, "findDirCache: %p\n", iter);257 debuglocal(pRes, 9, "findDirCache: %p\n", iter); 258 258 259 259 return iter; … … 363 363 }; 364 364 365 static int dcExistsInCache ( DirectoryCache *pdc, const char *path)365 static int dcExistsInCache (Resource *pRes, const char *path) 366 366 { 367 367 int rc = CacheFault; 368 368 369 if (p dc->fEnabled)370 { 371 if (dcFindDirCache (p dc, path, 0) != NULL)369 if (pRes->pdc->fEnabled) 370 { 371 if (dcFindDirCache (pRes, path, 0) != NULL) 372 372 { 373 373 rc = CacheOk; 374 374 } 375 375 376 debuglocal( 9, "ExistsInCache: [%s], %d\n", path, rc);376 debuglocal(pRes, 9, "ExistsInCache: [%s], %d\n", path, rc); 377 377 } 378 378 … … 380 380 } 381 381 382 static int dcRead ( DirectoryCache *pdc, const char *path,382 static int dcRead (Resource *pRes, const char *path, 383 383 PFNADDDIRENTRY fn, 384 384 filelist_state *state, … … 387 387 int i; 388 388 389 DirectoryCache *pdc = pRes->pdc; 389 390 int rc = CacheFault; 390 391 … … 393 394 DirectoryCacheEntry *pdce; 394 395 395 pdce = dcFindDirCache (p dc, path, 0);396 pdce = dcFindDirCache (pRes, path, 0); 396 397 397 398 if (pdce) 398 399 { 399 debuglocal( 9, "CacheRead: entry %p found for [%s]\n", pdce, path);400 debuglocal(pRes, 9, "CacheRead: entry %p found for [%s]\n", pdce, path); 400 401 401 402 if (fForceCache) … … 412 413 if (dceExpired (pdce, pdc->ulExpirationTime)) 413 414 { 414 debuglocal( 9, "CacheRead: expired\n");415 debuglocal(pRes, 9, "CacheRead: expired\n"); 415 416 dcRemoveEntry (pdce); 416 417 dceDelete (pdce); … … 433 434 } 434 435 435 debuglocal( 9, "CacheRead: [%s], %d\n", path, rc);436 debuglocal(pRes, 9, "CacheRead: [%s], %d\n", path, rc); 436 437 } 437 438 … … 439 440 } 440 441 441 static DirectoryCacheEntry *dcWriteBegin ( DirectoryCache *pdc, const char *path, int cFiles)442 static DirectoryCacheEntry *dcWriteBegin (Resource *pRes, const char *path, int cFiles) 442 443 { 443 444 DirectoryCacheEntry *pdce = NULL; 444 445 445 if (p dc->fEnabled)446 { 447 pdce = dcFindDirCache (p dc, path, 0);446 if (pRes->pdc->fEnabled) 447 { 448 pdce = dcFindDirCache (pRes, path, 0); 448 449 449 450 if (!pdce) 450 451 { 451 452 /* Does not exist in the cache yet. */ 452 dceCreate (&pdce, p dc, path, cFiles);453 dceCreate (&pdce, pRes, path, cFiles); 453 454 } 454 455 else … … 465 466 } 466 467 467 debuglocal( 9, "CacheWriteBegin: %s\n", path);468 debuglocal(pRes, 9, "CacheWriteBegin: %s\n", path); 468 469 } 469 470 … … 472 473 473 474 474 static void dcInvalidate ( DirectoryCache *pdc, const char *path, int fPrefix)475 static void dcInvalidate (Resource *pRes, const char *path, int fPrefix) 475 476 { 476 477 DirectoryCacheEntry *pdce; 477 478 478 debuglocal( 9, "CacheInvalidate: [%s]\n", path);479 480 pdce = dcFindDirCache (p dc, path, fPrefix);479 debuglocal(pRes, 9, "CacheInvalidate: [%s]\n", path); 480 481 pdce = dcFindDirCache (pRes, path, fPrefix); 481 482 482 483 while (pdce) … … 485 486 dceDelete (pdce); 486 487 487 pdce = dcFindDirCache (p dc, path, fPrefix);488 } 489 } 490 491 static int dcFindPath ( DirectoryCache *pdc,488 pdce = dcFindDirCache (pRes, path, fPrefix); 489 } 490 } 491 492 static int dcFindPath (Resource *pRes, DirectoryCache *pdc, 492 493 const char *path, 493 494 const char *parent, … … 500 501 unsigned long hash = computehash (parent); 501 502 502 debuglocal( 9, "dcFindPath: [%s][%s]\n", parent, name);503 debuglocal(pRes, 9, "dcFindPath: [%s][%s]\n", parent, name); 503 504 504 505 while (pdce != NULL) 505 506 { 506 debuglocal( 9, "dcFindPath: entry [%s]\n", pdce->pszPath);507 debuglocal(pRes, 9, "dcFindPath: entry [%s]\n", pdce->pszPath); 507 508 508 509 if ( pdce->ulHash == hash 509 && dcePathEqualsTo (p dce, parent))510 && dcePathEqualsTo (pRes, pdce, parent)) 510 511 { 511 512 /* This entry should contain the path. */ … … 517 518 *finfo = pdce->aInfos[i]; 518 519 *pulAge = timesec () - pdce->ulLastUpdateTime; 519 debuglocal( 9, "dircache: FindPath %s found, age %d\n", path, *pulAge);520 debuglocal(pRes, 9, "dircache: FindPath %s found, age %d\n", path, *pulAge); 520 521 return 1; 521 522 } … … 526 527 } 527 528 528 debuglocal( 9, "dircache: FindPath %s not found\n", path);529 debuglocal(pRes, 9, "dircache: FindPath %s not found\n", path); 529 530 return 0; 530 531 } … … 561 562 */ 562 563 563 int dircache_create(DirectoryCache **ppdc, unsigned long ulExpirationTime, int cMaxEntries) 564 { 564 int dircache_create(Resource *pRes) 565 { 566 struct DirectoryCache **ppdc = &pRes->pdc; 567 unsigned long ulExpirationTime = pRes->cachetimeout; 568 int cMaxEntries = pRes->cachedepth; 565 569 int rc; 566 570 567 debuglocal( 9, "dircache_create: %u seconds, %d entries\n", ulExpirationTime, cMaxEntries);571 debuglocal(pRes, 9, "dircache_create: %u seconds, %d entries\n", ulExpirationTime, cMaxEntries); 568 572 569 573 rc = dcCreate(ppdc); … … 574 578 } 575 579 576 debuglocal( 9, "dircache_create: %p, rc = %d\n", *ppdc, rc);580 debuglocal(pRes, 9, "dircache_create: %p, rc = %d\n", *ppdc, rc); 577 581 return rc; 578 582 } 579 583 580 void dircache_delete(DirectoryCache *pdc) 581 { 582 debuglocal(9, "dircache_delete: %p\n", pdc); 584 void dircache_delete(Resource *pRes) 585 { 586 DirectoryCache *pdc = pRes->pdc; 587 debuglocal(pRes, 9, "dircache_delete: %p\n", pdc); 583 588 584 589 if (pdc) … … 603 608 } 604 609 605 debuglocal( 9, "dircache_list_files [%s]\n", path);610 debuglocal(state->pConn->pRes, 9, "dircache_list_files [%s]\n", path); 606 611 607 612 if (!pdc) … … 612 617 lockRequest (pdc->mutex); 613 618 614 rc = dcRead ( pdc, path, fn, state, ptotal_received, 0);619 rc = dcRead (state->pConn->pRes, path, fn, state, ptotal_received, 0); 615 620 616 621 lockRelease (pdc->mutex); … … 632 637 } 633 638 634 debuglocal( 9, "dircache_write_begin pdc %p path [%s]\n", pdc, path);639 debuglocal(state->pConn->pRes, 9, "dircache_write_begin pdc %p path [%s]\n", pdc, path); 635 640 636 641 if (!pdc) … … 650 655 } 651 656 652 pdce = dcWriteBegin ( pdc, path, cFiles);657 pdce = dcWriteBegin (state->pConn->pRes, path, cFiles); 653 658 654 659 lockRelease (pdc->mutex); 655 660 656 debuglocal( 9, "dircache_write_begin returning ctx %p\n", pdce);661 debuglocal(state->pConn->pRes, 9, "dircache_write_begin returning ctx %p\n", pdce); 657 662 return (void *)pdce; 658 663 } 659 664 660 void dircache_write_entry( void *dircachectx, const smbwrp_fileinfo *finfo)665 void dircache_write_entry(Resource *pRes, void *dircachectx, const smbwrp_fileinfo *finfo) 661 666 { 662 667 DirectoryCacheEntry *pdce = (DirectoryCacheEntry *)dircachectx; 663 668 664 debuglocal( 9, "dircache_write_entry %p\n", pdce);669 debuglocal(pRes, 9, "dircache_write_entry %p\n", pdce); 665 670 666 671 if (!pdce) … … 671 676 lockRequest (pdce->pdc->mutex); 672 677 673 dceWriteEntry (p dce, finfo);678 dceWriteEntry (pRes, pdce, finfo); 674 679 675 680 lockRelease (pdce->pdc->mutex); 676 681 } 677 682 678 void dircache_write_end( void *dircachectx)683 void dircache_write_end(Resource *pRes, void *dircachectx) 679 684 { 680 685 DirectoryCacheEntry *pdce = (DirectoryCacheEntry *)dircachectx; 681 686 DirectoryCache *pdc; 682 687 683 debuglocal( 9, "dircache_write_end: pdce %p\n", pdce);688 debuglocal(pRes, 9, "dircache_write_end: pdce %p\n", pdce); 684 689 685 690 if (!pdce) … … 699 704 else 700 705 { 701 dceAdjust (p dce);706 dceAdjust (pRes, pdce); 702 707 dcInsertEntry (pdce); 703 708 } … … 707 712 708 713 void dircache_invalidate(const char *path, 709 struct DirectoryCache *pdc,714 Resource *pRes, 710 715 int fParent) 711 716 { 712 debuglocal(9, "dircache_invalidate [%s], parent %d\n", path, fParent); 717 struct DirectoryCache *pdc = pRes->pdc; 718 debuglocal(pRes, 9, "dircache_invalidate [%s], parent %d\n", path, fParent); 713 719 714 720 if (!pdc) … … 728 734 { 729 735 *lastSlash = 0; 730 dcInvalidate (p dc, p, 0);736 dcInvalidate (pRes, p, 0); 731 737 } 732 738 else 733 739 { 734 dcInvalidate (p dc, "", 0);740 dcInvalidate (pRes, "", 0); 735 741 } 736 742 } 737 743 else 738 744 { 739 dcInvalidate (p dc, path, 0);745 dcInvalidate (pRes, path, 0); 740 746 } 741 747 … … 745 751 } 746 752 747 int dircache_find_path( struct DirectoryCache *pdc,753 int dircache_find_path(Resource *pRes, 748 754 const char *path, 749 755 smbwrp_fileinfo *finfo, 750 756 unsigned long *pulAge) 751 757 { 758 struct DirectoryCache *pdc = pRes->pdc; 752 759 int cb; 753 760 char *p; … … 755 762 int fFound = 0; 756 763 757 debuglocal( 9, "dircache_find_path [%s]\n", path);764 debuglocal(pRes, 9, "dircache_find_path [%s]\n", path); 758 765 759 766 if (!pdc) … … 778 785 { 779 786 *lastSlash = 0; 780 fFound = dcFindPath (p dc, path, p, lastSlash + 1, finfo, pulAge);787 fFound = dcFindPath (pRes, pdc, path, p, lastSlash + 1, finfo, pulAge); 781 788 } 782 789 else 783 790 { 784 791 /* Find in the root directory. p is the name. */ 785 fFound = dcFindPath (p dc, path, "", p, finfo, pulAge);792 fFound = dcFindPath (pRes, pdc, path, "", p, finfo, pulAge); 786 793 } 787 794 -
trunk/client/src/help/changelog.txt
r883 r960 912 912 :ul. 913 913 #endif 914 914 915 <$UL>beta1: 915 916 #ifndef txt … … 930 931 #endif 931 932 933 <$UL>GA: 934 #ifndef txt 935 :ul compact. 936 #endif 937 #ifdef en 938 <$LI> added the possibility to create logfiles per share 939 #endif 940 #ifdef fr 941 <$LI> added the possibility to create logfiles per share 942 #endif 943 #ifdef de 944 <$LI> Mglichkeit um Logfiles pro Freigabe zu erstellen hinzugefgt 945 #endif 946 932 947 #ifndef txt 933 948 :eul.:eul. -
trunk/client/src/ndpsmb.c
r959 r960 35 35 36 36 /* time conversion functions: SMB protocol sends timestamps in GMT time, 37 *os2 api uses localtime,38 *emx/klibc uses timezone and daylight saving to convert GMT timestamps,39 *so only the timezone must be counted in conversion.40 */41 void fsphUnixTimeToDosDate( time_t time, FDATE* fdate, FTIME *ftime)37 * os2 api uses localtime, 38 * emx/klibc uses timezone and daylight saving to convert GMT timestamps, 39 * so only the timezone must be counted in conversion. 40 */ 41 void fsphUnixTimeToDosDate(Resource *pRes, time_t time, FDATE* fdate, FTIME *ftime) 42 42 { 43 43 struct tm* gmt = localtime( &time); … … 45 45 if (gmt->tm_isdst>0) 46 46 { 47 debuglocal( 9, "daylight saving in effect %d, timezone %d\n",gmt->tm_isdst, timezone);47 debuglocal(pRes, 9, "daylight saving in effect %d, timezone %d\n",gmt->tm_isdst, timezone); 48 48 time -= 3600; 49 49 gmt = localtime( &time); … … 56 56 ftime->minutes = gmt->tm_min; 57 57 ftime->hours = gmt->tm_hour; 58 } 59 60 void fsphDosDateToUnixTime( FDATE fdate, FTIME ftime, ULONG* time) 58 return; 59 } 60 61 void fsphDosDateToUnixTime(Resource *pRes, FDATE fdate, FTIME ftime, ULONG* time) 61 62 { 62 63 struct tm gmtime = { 0 }; 63 64 64 debuglocal( 9, "fsphDosDateToUnixTime time %02d:%02d:%02d\n", ftime.hours, ftime.minutes, ftime.twosecs*2);65 debuglocal(pRes, 9, "fsphDosDateToUnixTime time %02d:%02d:%02d\n", ftime.hours, ftime.minutes, ftime.twosecs*2); 65 66 gmtime.tm_mday = fdate.day; 66 67 gmtime.tm_mon = fdate.month-1; … … 72 73 73 74 *time = mktime( &gmtime); 74 debuglocal( 9, "fsphDosDateToUnixTime time1 %d %s", *time, ctime( (time_t*)time));75 debuglocal(pRes, 9, "fsphDosDateToUnixTime time1 %d %s", *time, ctime( (time_t*)time)); 75 76 #if 0 // as mktime() already does dst we don't need to add something 76 77 struct tm* gmt; … … 78 79 if (gmt->tm_isdst>0) 79 80 { 80 debuglocal( 9, "fsphDosDateToUnixTime daylight saving in effect %d, timezone %d\n",gmt->tm_isdst, timezone);81 debuglocal(pRes, 9, "fsphDosDateToUnixTime daylight saving in effect %d, timezone %d\n",gmt->tm_isdst, timezone); 81 82 *time += 3600; 82 83 } 83 debuglocal( 9, "fsphDosDateToUnixTime time2 %d %s", *time, ctime( (time_t*)time));84 debuglocal(pRes, 9, "fsphDosDateToUnixTime time2 %d %s", *time, ctime( (time_t*)time)); 84 85 #endif 86 return; 85 87 } 86 88 … … 111 113 {ND_PROP_ULONG, 0, "CLD", "32"}, 112 114 {ND_PROP_ULONG, 0, "EASUPPORT", "1"}, 115 {ND_PROP_ULONG, 0, "LOGLEVEL", "0"}, 113 116 {ND_PROP_STRING, 0, NULL, NULL} 114 117 }; … … 154 157 if (rcLock != NO_ERROR) \ 155 158 return rcLock; \ 159 smbwrp_Logging(pRes); \ 156 160 } while (0) 157 161 … … 165 169 #endif 166 170 167 int helperEASet ( cli_state *cli, FEALIST *pFEAList, char *path)171 int helperEASet (Resource *pRes, cli_state *cli, FEALIST *pFEAList, char *path) 168 172 { 169 173 int rc = 0; … … 181 185 while (done < pFEAList->cbList) 182 186 { 183 rc = smbwrp_setea( cli, path, (char*)(pfea + 1), pfea->cbValue ? (char *)(pfea + 1) + pfea->cbName + 1: NULL, pfea->cbValue);187 rc = smbwrp_setea(pRes, cli, path, (char*)(pfea + 1), pfea->cbValue ? (char *)(pfea + 1) + pfea->cbName + 1: NULL, pfea->cbValue); 184 188 if (rc) 185 189 break; … … 201 205 202 206 lockInit(); 203 debugInit();204 debuglocal(9,"Working with %s bit fileio NDFS\n", ifL ? "64" : "32");205 207 return NO_ERROR; 206 208 } … … 234 236 stat->attrFile = (finfo->attr & 0x37); 235 237 236 fsphUnixTimeToDosDate( finfo->mtime, &stat->fdateLastWrite, &stat->ftimeLastWrite);237 fsphUnixTimeToDosDate( finfo->ctime, &stat->fdateCreation, &stat->ftimeCreation);238 fsphUnixTimeToDosDate( finfo->atime, &stat->fdateLastAccess, &stat->ftimeLastAccess);238 fsphUnixTimeToDosDate(pConn->pRes, finfo->mtime, &stat->fdateLastWrite, &stat->ftimeLastWrite); 239 fsphUnixTimeToDosDate(pConn->pRes, finfo->ctime, &stat->fdateCreation, &stat->ftimeCreation); 240 fsphUnixTimeToDosDate(pConn->pRes, finfo->atime, &stat->fdateLastAccess, &stat->ftimeLastAccess); 239 241 return; 240 242 } … … 259 261 stat.attrFile = (finfo->attr & 0x37); 260 262 261 fsphUnixTimeToDosDate( finfo->mtime, &stat.fdateLastWrite, &stat.ftimeLastWrite);262 fsphUnixTimeToDosDate( finfo->ctime, &stat.fdateCreation, &stat.ftimeCreation);263 fsphUnixTimeToDosDate( finfo->atime, &stat.fdateLastAccess, &stat.ftimeLastAccess);264 debuglocal( 9, "fname %s\n", finfo->fname);265 debuglocal( 9, "mtime %d %s", finfo->mtime, ctime( (time_t*)&finfo->mtime));266 debuglocal( 9, "ftimeLastAccess %02d:%02d:%02d\n", stat.ftimeLastWrite.hours, stat.ftimeLastWrite.minutes, stat.ftimeLastWrite.twosecs*2);263 fsphUnixTimeToDosDate(pConn->pRes, finfo->mtime, &stat.fdateLastWrite, &stat.ftimeLastWrite); 264 fsphUnixTimeToDosDate(pConn->pRes, finfo->ctime, &stat.fdateCreation, &stat.ftimeCreation); 265 fsphUnixTimeToDosDate(pConn->pRes, finfo->atime, &stat.fdateLastAccess, &stat.ftimeLastAccess); 266 debuglocal(pConn->pRes, 9, "fname %s\n", finfo->fname); 267 debuglocal(pConn->pRes, 9, "mtime %d %s", finfo->mtime, ctime( (time_t*)&finfo->mtime)); 268 debuglocal(pConn->pRes, 9, "ftimeLastAccess %02d:%02d:%02d\n", stat.ftimeLastWrite.hours, stat.ftimeLastWrite.minutes, stat.ftimeLastWrite.twosecs*2); 267 269 268 270 ph->fsphAddFile32L(plist, &stat, name, strlen(name), finfo, sizeof(*finfo), 0); … … 344 346 #endif 345 347 pRes->pdc = NULL; 348 pRes->loglevel = 0; 346 349 347 350 t = 0, q = NULL; … … 451 454 } 452 455 456 t = 0; 457 rc = ph->fsphQueryUlongProperty (properties, "LOGLEVEL", &t); 458 if (!rc) 459 { 460 if (t > 10) 461 rc = ERROR_INVALID_PARAMETER; 462 else 463 pRes->loglevel = t; 464 } 465 466 // figure out the used share/server/workgroup 467 char *logfileext = '\0'; 468 if (pRes->srv.share_name) 469 logfileext = pRes->srv.share_name; 470 if (!logfileext && pRes->srv.server_name) 471 logfileext = pRes->srv.server_name; 472 if (!logfileext && pRes->srv.workgroup) 473 logfileext = pRes->srv.workgroup; 474 475 // init debug and write the very first message 476 debugInit(pRes, logfileext, ifL); 477 debuglocal(pRes, 9, "NdpMountResource initResource\n"); 478 479 // init code 480 smbwrp_init(pRes); 481 453 482 /* 454 483 * Create a directory cache with expiration time and cache listings 455 484 * the above values come from the gui. default: timeout 10; listings: 32 456 485 */ 457 dircache_create( &pRes->pdc, pRes->cachetimeout, pRes->cachedepth);486 dircache_create(pRes); 458 487 459 488 return rc; … … 562 591 // reconnect to server here, first test new connection 563 592 cli_state* tmp_cli = NULL; 564 rc = smbwrp_connect( 593 rc = smbwrp_connect(&tmpRes, &tmp_cli); 565 594 if (!rc) 566 595 { 567 596 // new connection is ok, disconnect old one 568 597 cli_state* cli = pConn->cli; 569 smbwrp_disconnect( 598 smbwrp_disconnect(pRes, cli); 570 599 // save tmp data structure 571 600 memcpy( pRes, &tmpRes, sizeof( tmpRes)); … … 582 611 583 612 /* check if the requested resource is available */ 584 static int checkMountResource( 613 static int checkMountResource(Resource* pRes) 585 614 { 586 615 int rc; … … 588 617 cli_state* cli = NULL; 589 618 590 debuglocal( 9, "checkMountResource in tid#%d\n", _gettid());591 rc = smbwrp_connect( 619 debuglocal(pRes, 9, "checkMountResource in tid#%d\n", _gettid()); 620 rc = smbwrp_connect(pRes, &cli); 592 621 switch (rc) 593 622 { … … 620 649 } /* endswitch */ 621 650 622 smbwrp_disconnect( 651 smbwrp_disconnect(pRes, cli); 623 652 return rc; 624 653 } … … 631 660 632 661 ENTER(); 633 634 debuglocal(9,"NdpMountResource in\n");635 // init code636 smbwrp_init();637 662 638 663 /* … … 666 691 } 667 692 668 debuglocal( 9, "NdpMountResource rc=%d\n", rc);693 debuglocal(pRes, 9, "NdpMountResource rc=%d\n", rc); 669 694 LEAVE(); 670 695 return rc; … … 675 700 Resource *pRes = (Resource *)resource; 676 701 ENTER(); 677 dircache_delete(pRes ->pdc);702 dircache_delete(pRes); 678 703 memset(&pRes->srv, 0, sizeof(pRes->srv)); 704 debuglocal(pRes, 9, "NdpFreeResource %d\n", NO_ERROR); 705 debugClose(pRes); 679 706 free(pRes); 680 debuglocal(9, "NdpFreeResource %d\n", NO_ERROR);681 707 LEAVE(); 682 708 return NO_ERROR; … … 689 715 int rc = ND_RSRC_DIFFERENT; 690 716 691 debuglocal( 9, "NdpRsrcCompare in\n");717 debuglocal(pRes, 9, "NdpRsrcCompare in\n"); 692 718 if (ph->fsphStrICmp(pRes->srv.server_name, pRes2->srv.server_name) == 0 693 719 && ph->fsphStrICmp(pRes->srv.share_name, pRes2->srv.share_name) == 0 … … 699 725 } 700 726 701 debuglocal( 9, "NdpRsrcCompare %d\n", rc);727 debuglocal(pRes, 9, "NdpRsrcCompare %d\n", rc); 702 728 return rc; 703 729 } … … 706 732 { 707 733 // do nothing 708 debuglocal(9, "NdpRsrcUpdate %d\n", NO_ERROR); 734 Resource *pRes = (Resource *)resource; 735 debuglocal(pRes, 9, "NdpRsrcUpdate %d\n", NO_ERROR); 709 736 return NO_ERROR; 710 737 } … … 716 743 char s[4096]; 717 744 718 debuglocal( 9, "NdpRsrcQueryInfo in\n");745 debuglocal(pRes, 9, "NdpRsrcQueryInfo in\n"); 719 746 720 747 switch (pRes->rootlevel) … … 739 766 memcpy(pdata, s, *poutlen); 740 767 741 debuglocal( 9, "NdpRsrcQueryInfo %d\n", rc);768 debuglocal(pRes, 9, "NdpRsrcQueryInfo %d\n", rc); 742 769 return rc; 743 770 } … … 759 786 760 787 ENTER(); 761 debuglocal( 9, "NdpRsrcQueryFSAllocate %08x\n", pfsa);788 debuglocal(pRes, 9, "NdpRsrcQueryFSAllocate %08x\n", pfsa); 762 789 763 790 if (!pfsa) … … 767 794 } 768 795 769 debuglocal( 9, "NdpRsrcQueryFSAllocate in tid#%d\n", _gettid());770 rc = smbwrp_connect( 796 debuglocal(pRes, 9, "NdpRsrcQueryFSAllocate in tid#%d\n", _gettid()); 797 rc = smbwrp_connect(pRes, &cli); 771 798 if (rc) 772 799 { 773 debuglocal( 9, "NdpRsrcQueryFSAllocate smbwrp_connect failed rc=%d\n", rc);800 debuglocal(pRes, 9, "NdpRsrcQueryFSAllocate smbwrp_connect failed rc=%d\n", rc); 774 801 pfsa->cSectorUnit = 1; 775 802 pfsa->cUnit = 123456; … … 781 808 } 782 809 783 rc = smbwrp_dskattr( cli, &fsa);810 rc = smbwrp_dskattr(pRes, cli, &fsa); 784 811 if (rc) 785 812 { … … 798 825 } 799 826 800 smbwrp_disconnect( 801 debuglocal( 9, "NdpRsrcQueryFSAllocate %d/%d (cUnit = %d/cUnitAvail = %d/cbSector = %d)\n", rc, rc1, pfsa->cUnit, pfsa->cUnitAvail, pfsa->cbSector);827 smbwrp_disconnect(pRes, cli); 828 debuglocal(pRes, 9, "NdpRsrcQueryFSAllocate %d/%d (cUnit = %d/cUnitAvail = %d/cbSector = %d)\n", rc, rc1, pfsa->cUnit, pfsa->cUnitAvail, pfsa->cbSector); 802 829 803 830 LEAVE(); … … 814 841 ENTER(); 815 842 816 debuglocal( 9, "NdpCreateConnection in\n");843 debuglocal(pRes, 9, "NdpCreateConnection in\n"); 817 844 818 845 pConn = malloc( sizeof(Connection)); … … 822 849 if (rc) 823 850 { 824 debuglocal( 9, "NdpCreateConnection ERROR_NOT_ENOUGH_MEMORY %d\n", rc);851 debuglocal(pRes, 9, "NdpCreateConnection ERROR_NOT_ENOUGH_MEMORY %d\n", rc); 825 852 LEAVE(); 826 853 return rc; … … 831 858 pConn->file.fd = -1; 832 859 833 debuglocal( 9, "NdpCreateConnection send CONNECT\n");834 rc = smbwrp_connect( 860 debuglocal(pRes, 9, "NdpCreateConnection send CONNECT\n"); 861 rc = smbwrp_connect(pRes, &pConn->cli); 835 862 if (rc) 836 863 { … … 841 868 842 869 *pconn = (HCONNECTION)pConn; 843 debuglocal( 9, "NdpCreateConnection [%p] %d\n", pConn, rc);870 debuglocal(pRes, 9, "NdpCreateConnection [%p] %d\n", pConn, rc); 844 871 845 872 LEAVE(); … … 855 882 ENTER(); 856 883 857 debuglocal( 9, "NdpFreeConnection in [%p]\n", pConn);884 debuglocal(pRes, 9, "NdpFreeConnection in [%p]\n", pConn); 858 885 if (pConn->file.fd >= 0) 859 886 { 860 rc = smbwrp_close( pConn->cli, &pConn->file);887 rc = smbwrp_close(pRes, pConn->cli, &pConn->file); 861 888 pConn->file.fd = -1; 862 889 } 863 890 864 smbwrp_disconnect( pRes, pConn->cli); 865 891 smbwrp_disconnect(pRes, pConn->cli); 892 893 debuglocal(pRes, 9, "NdpFreeConnection %d\n", NO_ERROR); 866 894 free(pConn); 867 debuglocal(9, "NdpFreeConnection %d\n", NO_ERROR);868 895 869 896 LEAVE(); … … 900 927 ENTER(); 901 928 902 debuglocal( 9, "NdpQueryPathInfo in [%p] <%s>\n", pConn, szPath);929 debuglocal(pRes, 9, "NdpQueryPathInfo in [%p] <%s>\n", pConn, szPath); 903 930 904 931 /* … … 915 942 // First check if there is information in the directory cache. 916 943 unsigned long ulAge = 0; 917 if (dircache_find_path(pRes ->pdc, szPath, &finfo, &ulAge))944 if (dircache_find_path(pRes, szPath, &finfo, &ulAge)) 918 945 { 919 946 if (ulAge <= 15) /* @todo configurable. */ … … 927 954 928 955 rc = pathparser(pRes, pConn, szPath, path); 929 debuglocal( 9, "NdpQueryPathInfo pathparser for <%s> rc=%d\n", path, rc);956 debuglocal(pRes, 9, "NdpQueryPathInfo pathparser for <%s> rc=%d\n", path, rc); 930 957 switch (rc) 931 958 { … … 944 971 945 972 strncpy(finfo.fname, path, sizeof(finfo.fname) - 1); 946 debuglocal( 9, "NdpQueryPathInfo smbwrp_getattr for <%s>\n", path);947 rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo);973 debuglocal(pRes, 9, "NdpQueryPathInfo smbwrp_getattr for <%s>\n", path); 974 rc = smbwrp_getattr(pRes, &pRes->srv, pConn->cli, &finfo); 948 975 if (rc) 949 976 { … … 952 979 { 953 980 // free current cli resources 954 smbwrp_disconnect( 981 smbwrp_disconnect(pRes, pConn->cli); 955 982 // reconnect 956 rcCon = smbwrp_connect( 983 rcCon = smbwrp_connect(pRes, &pConn->cli); 957 984 if (rcCon != NO_ERROR) 958 debuglocal( 9, "NdpQueryPathInfo smbwrp_connect rc = %d\n", rcCon);985 debuglocal(pRes, 9, "NdpQueryPathInfo smbwrp_connect rc = %d\n", rcCon); 959 986 // try file list again if reconnecting worked 960 987 if (rcCon == NO_ERROR) 961 rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo);988 rc = smbwrp_getattr(pRes, &pRes->srv, pConn->cli, &finfo); 962 989 } 963 990 964 debuglocal( 9, "NdpQueryPathInfo smbwrp_getattr, rc = %d\n", rc);991 debuglocal(pRes, 9, "NdpQueryPathInfo smbwrp_getattr, rc = %d\n", rc); 965 992 switch (rc) 966 993 { … … 989 1016 { 990 1017 *p = 0; 991 rc = smbwrp_getattr( &pRes->srv, pConn->cli, &finfo);992 debuglocal( 9, "NdpQueryPathInfo upper path in <%s>, rc = %d\n", finfo.fname, rc);1018 rc = smbwrp_getattr(pRes, &pRes->srv, pConn->cli, &finfo); 1019 debuglocal(pRes, 9, "NdpQueryPathInfo upper path in <%s>, rc = %d\n", finfo.fname, rc); 993 1020 if (rc == NO_ERROR) 994 1021 rc = (finfo.attr & FILE_DIRECTORY) !=0 ? ERROR_FILE_NOT_FOUND:ERROR_PATH_NOT_FOUND; … … 998 1025 } 999 1026 } while (0); 1000 debuglocal( 9, "NdpQueryPathInfo <%s> (%s) %d\n", szPath, path, rc);1027 debuglocal(pRes, 9, "NdpQueryPathInfo <%s> (%s) %d\n", szPath, path, rc); 1001 1028 1002 1029 LEAVE(); … … 1020 1047 ENTER(); 1021 1048 1022 debuglocal( 9, "NdpFindStart in [%p]\n", pConn);1049 debuglocal(pRes, 9, "NdpFindStart in [%p]\n", pConn); 1023 1050 1024 1051 strncpy(dir, szPath, sizeof(dir) - 1); … … 1076 1103 strcpy(state.mask, "\\*"); 1077 1104 1078 debuglocal( 9, "NdpFindStart: dir [%s], dir_mask [%s], mask [%s], szPath [%s]\n",1105 debuglocal(pRes, 9, "NdpFindStart: dir [%s], dir_mask [%s], mask [%s], szPath [%s]\n", 1079 1106 state.dir, state.dir_mask, state.mask, state.fullpath); 1080 rc = smbwrp_filelist( &pRes->srv, pConn->cli, &state);1107 rc = smbwrp_filelist(pRes, &pRes->srv, pConn->cli, &state); 1081 1108 /* 1082 1109 * we need to handle reconnection also here, because NdpQueryPathInfo … … 1087 1114 { 1088 1115 // free current cli resources 1089 smbwrp_disconnect( 1116 smbwrp_disconnect(pRes, pConn->cli); 1090 1117 // reconnect 1091 smbwrp_connect( 1118 smbwrp_connect(pRes, &pConn->cli); 1092 1119 // try file list again next loop 1093 rc = smbwrp_filelist( &pRes->srv, pConn->cli, &state);1094 debuglocal( 9, "NdpFindStart remote connection lost, rc = %d\n", rc);1095 } 1096 1097 debuglocal( 9, "NdpFindStart <%s> (%s) cnt %d %d\n", szPath, path, count, rc);1120 rc = smbwrp_filelist(pRes, &pRes->srv, pConn->cli, &state); 1121 debuglocal(pRes, 9, "NdpFindStart remote connection lost, rc = %d\n", rc); 1122 } 1123 1124 debuglocal(pRes, 9, "NdpFindStart <%s> (%s) cnt %d %d\n", szPath, path, count, rc); 1098 1125 1099 1126 LEAVE(); … … 1103 1130 int APIENTRY NdpDeletePathInfo (HRESOURCE resource, NDFILEINFOL *pfi) 1104 1131 { 1105 debuglocal(9, "NdpDeletePathInfo %d\n", 0); 1132 Resource * pRes = (Resource *)resource; 1133 debuglocal(pRes, 9, "NdpDeletePathInfo %d\n", 0); 1106 1134 return NO_ERROR; 1107 1135 } … … 1109 1137 int APIENTRY NdpRefresh (HCONNECTION conn, char *path, int tree) 1110 1138 { 1111 debuglocal(9, "NdpRefresh <%s> %d\n", path, 0); 1139 Connection *pConn = (Connection *)conn; 1140 debuglocal(pConn->pRes, 9, "NdpRefresh <%s> %d\n", path, 0); 1112 1141 return NO_ERROR; 1113 1142 } … … 1121 1150 */ 1122 1151 1123 debuglocal(9, "NdpDicardresourceData %d\n", 0); 1152 Resource * pRes = (Resource *)resource; 1153 debuglocal(pRes, 9, "NdpDicardresourceData %d\n", 0); 1124 1154 return NO_ERROR; 1125 1155 } … … 1136 1166 ENTER(); 1137 1167 1138 debuglocal( 9, "NdpSetPathInfo in [%p]\n", pConn);1168 debuglocal(pRes, 9, "NdpSetPathInfo in [%p]\n", pConn); 1139 1169 1140 1170 // delete the dir cache 1141 dircache_invalidate(szPathName, pRes ->pdc, 1);1171 dircache_invalidate(szPathName, pRes, 1); 1142 1172 1143 1173 do { … … 1148 1178 memset(&finfo, 0, sizeof(finfo)); 1149 1179 strncpy(finfo.fname, path, sizeof(finfo.fname) - 1); 1150 fsphDosDateToUnixTime(p fi->stat.fdateLastWrite, pfi->stat.ftimeLastWrite, &(finfo.mtime));1180 fsphDosDateToUnixTime(pRes, pfi->stat.fdateLastWrite, pfi->stat.ftimeLastWrite, &(finfo.mtime)); 1151 1181 finfo.attr = pfi->stat.attrFile & 0x37; 1152 rc = smbwrp_setattr(p Conn->cli, &finfo);1182 rc = smbwrp_setattr(pRes, pConn->cli, &finfo); 1153 1183 } while (0); 1154 1184 1155 debuglocal( 9, "NdpSetPathInfo <%s> (%s) %d\n", szPathName, path, rc);1156 1157 LEAVE(); 1158 return rc; 1159 } 1160 1161 int buildFEALIST( FEALIST *pFEASrc, GEALIST *pGEAList, FEALIST *pFEAList)1185 debuglocal(pRes, 9, "NdpSetPathInfo <%s> (%s) %d\n", szPathName, path, rc); 1186 1187 LEAVE(); 1188 return rc; 1189 } 1190 1191 int buildFEALIST(Resource *pRes, FEALIST *pFEASrc, GEALIST *pGEAList, FEALIST *pFEAList) 1162 1192 { 1163 1193 int rc = 0; … … 1173 1203 pfeadest = pFEAList->list; 1174 1204 dsize = pFEAList->cbList; 1175 //debuglocal( 9,"buildFEALIST in destsize %d srcsize %d pGEAList=%08x pGEAList->cbList=%d\n", dsize, ddone, size, pGEAList, pGEAList ? pGEAList->cbList : 0);1205 //debuglocal(pRes, 9,"buildFEALIST in destsize %d srcsize %d pGEAList=%08x pGEAList->cbList=%d\n", dsize, ddone, size, pGEAList, pGEAList ? pGEAList->cbList : 0); 1176 1206 1177 1207 while (done < size) … … 1187 1217 while (done < size) 1188 1218 { 1189 //debuglocal( 9,"comp <%s> <%s>\n", name, pgea->szName);1219 //debuglocal(pRes, 9,"comp <%s> <%s>\n", name, pgea->szName); 1190 1220 if (!ph->fsphStrNCmp(name, pgea->szName, pgea->cbName)) 1191 1221 { … … 1211 1241 } 1212 1242 done += sizeof(FEA) + pfea->cbName + 1 + pfea->cbValue; 1213 //debuglocal( 9,"buuildfea <%s> insert=%d pfea->cbName=%d pfea->cbValue=%d srcdone=%d destdone=%d pfeadest=%08x pfea=%08x\n", name, insert, pfea->cbName, pfea->cbValue, done, ddone, pfeadest, pfea);1243 //debuglocal(pRes, 9,"buuildfea <%s> insert=%d pfea->cbName=%d pfea->cbValue=%d srcdone=%d destdone=%d pfeadest=%08x pfea=%08x\n", name, insert, pfea->cbName, pfea->cbValue, done, ddone, pfeadest, pfea); 1214 1244 pfea = (FEA *)((char *)pFEASrc + done); 1215 1245 } … … 1219 1249 rc = ERROR_BUFFER_OVERFLOW; 1220 1250 1221 debuglocal( 9, "buildFEALIST rc=%d destsize=%d destdone=%d srcsize=%d pGEAList=%08x\n", rc, dsize, ddone, size, pGEAList);1251 debuglocal(pRes, 9, "buildFEALIST rc=%d destsize=%d destdone=%d srcsize=%d pGEAList=%08x\n", rc, dsize, ddone, size, pGEAList); 1222 1252 return rc; 1223 1253 } … … 1244 1274 if (rc || !fdata.ulSize || !fdata.pData) 1245 1275 { 1246 debuglocal( 9, "NdpEAQuery: ph->fsphGetFileInfoData = %d/%d %08x\n", rc, fdata.ulSize, fdata.pData);1276 debuglocal(pRes, 9, "NdpEAQuery: ph->fsphGetFileInfoData = %d/%d %08x\n", rc, fdata.ulSize, fdata.pData); 1247 1277 return ERROR_EAS_NOT_SUPPORTED; 1248 1278 } … … 1252 1282 finfo = (smbwrp_fileinfo *)fdata.pData; 1253 1283 path = finfo->fname; 1254 debuglocal( 9, "NdpEAQuery in [%p] <%s> %08x %d\n", pConn, path, pGEAList, pGEAList ? pGEAList->cbList : 0);1284 debuglocal(pRes, 9, "NdpEAQuery in [%p] <%s> %08x %d\n", pConn, path, pGEAList, pGEAList ? pGEAList->cbList : 0); 1255 1285 1256 1286 char *pchBuffer = (char *)malloc(cbBuffer); … … 1262 1292 1263 1293 do { 1264 rc = smbwrp_listea( pConn->cli, path, pchBuffer, cbBuffer);1294 rc = smbwrp_listea(pRes, pConn->cli, path, pchBuffer, cbBuffer); 1265 1295 pFEASrc = (FEALIST*) pchBuffer; 1266 1296 if (rc) … … 1281 1311 } 1282 1312 else 1283 rc = buildFEALIST( (FEALIST *)pFEASrc, pGEAList, pFEAList);1313 rc = buildFEALIST(pRes, (FEALIST *)pFEASrc, pGEAList, pFEAList); 1284 1314 } while (0); 1285 1315 1286 1316 free(pchBuffer); 1287 debuglocal( 9, "NdpEAQuery <%s> %d %d %d\n", pfi->pszName, rc, pFEASrc->cbList, pFEAList->cbList);1317 debuglocal(pRes, 9, "NdpEAQuery <%s> %d %d %d\n", pfi->pszName, rc, pFEASrc->cbList, pFEAList->cbList); 1288 1318 1289 1319 LEAVE(); … … 1301 1331 smbwrp_fileinfo *finfo; 1302 1332 1303 debuglocal( 9, "NdpEASet in [%p]\n", pConn);1333 debuglocal(pRes, 9, "NdpEASet in [%p]\n", pConn); 1304 1334 1305 1335 if (!pfi || !pfi->pszName) … … 1312 1342 if (rc || !fdata.ulSize || !fdata.pData) 1313 1343 { 1314 debuglocal( 9, "NdpEASet: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData);1344 debuglocal(pRes, 9, "NdpEASet: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData); 1315 1345 return ERROR_EAS_NOT_SUPPORTED; 1316 1346 } … … 1319 1349 path = finfo->fname; 1320 1350 1321 rc = helperEASet(p Conn->cli, pFEAList, path);1322 debuglocal( 9, "NdpEASet %d\n", rc);1351 rc = helperEASet(pRes, pConn->cli, pFEAList, path); 1352 debuglocal(pRes, 9, "NdpEASet %d\n", rc); 1323 1353 return rc; 1324 1354 } … … 1346 1376 if (rc || !fdata.ulSize || !fdata.pData) 1347 1377 { 1348 debuglocal( 9, "NdpEASize: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData);1378 debuglocal(pRes, 9, "NdpEASize: ph->fsphGetFileInfoData = %d/%d/%08x\n", rc, fdata.ulSize, fdata.pData); 1349 1379 return ERROR_EAS_NOT_SUPPORTED; 1350 1380 } … … 1359 1389 { 1360 1390 *pulEASize = easize; 1361 debuglocal( 9, "NdpEASize <%s> cached %d\n", path, easize);1391 debuglocal(pRes, 9, "NdpEASize <%s> cached %d\n", path, easize); 1362 1392 LEAVE(); 1363 1393 return NO_ERROR; 1364 1394 } 1365 1395 1366 debuglocal( 9, "NdpEASize in [%p] <%s> \n", pConn, path);1396 debuglocal(pRes, 9, "NdpEASize in [%p] <%s> \n", pConn, path); 1367 1397 1368 1398 char *pchBuffer = (char *)malloc(cbBuffer); … … 1374 1404 1375 1405 do { 1376 rc = smbwrp_listea(p Conn->cli, path, pchBuffer, cbBuffer);1406 rc = smbwrp_listea(pRes, pConn->cli, path, pchBuffer, cbBuffer); 1377 1407 pfealist = (FEALIST*)pchBuffer; 1378 1408 if (rc) … … 1394 1424 1395 1425 free(pchBuffer); 1396 debuglocal( 9, "NdpEASize <%s> %d %d\n", pfi->pszName, *pulEASize, rc);1426 debuglocal(pRes, 9, "NdpEASize <%s> %d %d\n", pfi->pszName, *pulEASize, rc); 1397 1427 1398 1428 LEAVE(); … … 1408 1438 char path[CCHMAXPATH+1] = {0}; 1409 1439 1410 debuglocal( 9, "NdpSetCurrentDir in [%p]\n", pConn);1440 debuglocal(pRes, 9, "NdpSetCurrentDir in [%p]\n", pConn); 1411 1441 1412 1442 ENTER(); … … 1417 1447 break; 1418 1448 1419 rc = smbwrp_chdir( &pRes->srv, pConn->cli, path);1449 rc = smbwrp_chdir(pRes, &pRes->srv, pConn->cli, path); 1420 1450 } while (0); 1421 1451 1422 debuglocal( 9, "NdpSetCurrentDir <%s> (%s) %d\n", szPath, path, rc);1452 debuglocal(pRes, 9, "NdpSetCurrentDir <%s> (%s) %d\n", szPath, path, rc); 1423 1453 1424 1454 LEAVE(); … … 1428 1458 int APIENTRY NdpCopy (HCONNECTION conn, NDFILEINFOL *pfiDst, char *szDst, NDFILEINFOL *pfiSrc, char *szSrc, ULONG ulOption) 1429 1459 { 1430 debuglocal(9, "NdpCopy <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY); 1460 Connection *pConn = (Connection *)conn; 1461 Resource *pRes = pConn->pRes; 1462 debuglocal(pRes, 9, "NdpCopy <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY); 1431 1463 return ERROR_CANNOT_COPY; 1432 1464 } … … 1434 1466 int APIENTRY NdpCopy2 (HCONNECTION conn, HRESOURCE resDst, NDFILEINFOL *pfiDst, char *szDst, NDFILEINFOL *pfiSrc, char *szSrc, ULONG ulOption) 1435 1467 { 1436 debuglocal(9, "NdpCopy2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY); 1468 Connection *pConn = (Connection *)conn; 1469 Resource *pRes = pConn->pRes; 1470 debuglocal(pRes, 9, "NdpCopy2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_CANNOT_COPY); 1437 1471 return ERROR_CANNOT_COPY; 1438 1472 } … … 1448 1482 ENTER(); 1449 1483 1450 debuglocal( 9, "NdpForceDelete in [%p]\n", pConn);1451 1452 dircache_invalidate(szFile, pRes ->pdc, 1);1484 debuglocal(pRes, 9, "NdpForceDelete in [%p]\n", pConn); 1485 1486 dircache_invalidate(szFile, pRes, 1); 1453 1487 1454 1488 do { … … 1457 1491 break; 1458 1492 1459 rc = smbwrp_unlink(p Conn->cli, path);1493 rc = smbwrp_unlink(pRes, pConn->cli, path); 1460 1494 } while (0); 1461 1495 1462 debuglocal( 9, "NdpForceDelete <%s> (%s) %d\n", szFile, path, rc);1496 debuglocal(pRes, 9, "NdpForceDelete <%s> (%s) %d\n", szFile, path, rc); 1463 1497 1464 1498 LEAVE(); … … 1477 1511 ENTER(); 1478 1512 1479 debuglocal( 9, "NdpCreateDir in [%p]\n", pConn);1480 1481 dircache_invalidate(szDirName, pRes ->pdc, 1);1513 debuglocal(pRes, 9, "NdpCreateDir in [%p]\n", pConn); 1514 1515 dircache_invalidate(szDirName, pRes, 1); 1482 1516 1483 1517 do { … … 1486 1520 break; 1487 1521 1488 rc = smbwrp_mkdir(p Conn->cli, path);1522 rc = smbwrp_mkdir(pRes, pConn->cli, path); 1489 1523 } while (0); 1490 1524 … … 1492 1526 1493 1527 if (path && pRes->easupport) 1494 rcEASet = helperEASet(p Conn->cli, pFEAList, path);1495 1496 debuglocal( 9, "NdpCreateDir <%s> (%s) rc=%d, EASupport=%s rc=%d\n", szDirName, path, rc, pRes->easupport?"yes":"no", rcEASet);1528 rcEASet = helperEASet(pRes, pConn->cli, pFEAList, path); 1529 1530 debuglocal(pRes, 9, "NdpCreateDir <%s> (%s) rc=%d, EASupport=%s rc=%d\n", szDirName, path, rc, pRes->easupport?"yes":"no", rcEASet); 1497 1531 1498 1532 return rc; … … 1509 1543 ENTER(); 1510 1544 1511 debuglocal( 9, "NdpDeleteDir in [%p]\n", pConn);1512 1513 dircache_invalidate(szDir, pRes ->pdc, 1);1545 debuglocal(pRes, 9, "NdpDeleteDir in [%p]\n", pConn); 1546 1547 dircache_invalidate(szDir, pRes, 1); 1514 1548 1515 1549 do { … … 1518 1552 break; 1519 1553 1520 rc = smbwrp_rmdir(p Conn->cli, path);1554 rc = smbwrp_rmdir(pRes, pConn->cli, path); 1521 1555 } while (0); 1522 1556 1523 debuglocal( 9, "NdpDeleteDir <%s> (%s) %d\n", szDir, path, rc);1557 debuglocal(pRes, 9, "NdpDeleteDir <%s> (%s) %d\n", szDir, path, rc); 1524 1558 1525 1559 LEAVE(); … … 1539 1573 ENTER(); 1540 1574 1541 debuglocal( 9, "NdpMove in [%p] from <%s> to <%s>\n", pConn, szSrc, szDst);1542 1543 dircache_invalidate(szSrc, pRes ->pdc, 1);1544 dircache_invalidate(szDst, pRes ->pdc, 1);1575 debuglocal(pRes, 9, "NdpMove in [%p] from <%s> to <%s>\n", pConn, szSrc, szDst); 1576 1577 dircache_invalidate(szSrc, pRes, 1); 1578 dircache_invalidate(szDst, pRes, 1); 1545 1579 1546 1580 do … … 1565 1599 p = szDst + l1 - l2 + 1; 1566 1600 } 1567 rc = smbwrp_rename(p Conn->cli, src, p);1601 rc = smbwrp_rename(pRes, pConn->cli, src, p); 1568 1602 } while (0); 1569 1603 1570 debuglocal( 9, "NdpMove <%s> -> <%s> (%s) %d\n", szSrc, szDst, src, rc);1604 debuglocal(pRes, 9, "NdpMove <%s> -> <%s> (%s) %d\n", szSrc, szDst, src, rc); 1571 1605 1572 1606 LEAVE(); … … 1576 1610 int APIENTRY NdpMove2 (HCONNECTION conn, HRESOURCE resDst, NDFILEINFOL *pfiDst, char *szDst, NDFILEINFOL *pfiSrc, char *szSrc) 1577 1611 { 1578 debuglocal(9, "NdpMove2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_WRITE_PROTECT); 1612 Connection *pConn = (Connection *)conn; 1613 Resource *pRes = pConn->pRes; 1614 debuglocal(pRes, 9, "NdpMove2 <%s> -> <%s> %d\n", szSrc, szDst, ERROR_WRITE_PROTECT); 1579 1615 return ERROR_WRITE_PROTECT; 1580 1616 } … … 1600 1636 ENTER(); 1601 1637 1602 debuglocal( 9, "smbopen in [%p] %d\n", pConn, pConn->file.fd);1638 debuglocal(pRes, 9, "smbopen in [%p] %d\n", pConn, pConn->file.fd); 1603 1639 1604 1640 if (flags & O_CREAT) 1605 dircache_invalidate(szFileName, pRes ->pdc, 1);1641 dircache_invalidate(szFileName, pRes, 1); 1606 1642 1607 1643 do { … … 1637 1673 pConn->file.openattr = ulAttribute & 0x37; 1638 1674 pConn->file.denymode = (ulOpenMode & 0x70) >> 4; 1639 rc = smbwrp_open(pConn-> cli, &pConn->file);1675 rc = smbwrp_open(pConn->pRes, pConn->cli, &pConn->file); 1640 1676 } while (0); 1641 1677 1642 debuglocal( 9, "smbopen <%s> (%s) %08x %08x %08x %d. file = %d\n", szFileName, path, flags, ulOpenMode, ulAttribute, rc, pConn->file.fd);1678 debuglocal(pRes, 9, "smbopen <%s> (%s) %08x %08x %08x %d. file = %d\n", szFileName, path, flags, ulOpenMode, ulAttribute, rc, pConn->file.fd); 1643 1679 if (!rc && pFEAList) 1644 1680 { 1645 1681 int rc1 = NdpFileEASet((HCONNECTION)pConn, (NDFILEHANDLE)0, pFEAList); 1646 debuglocal( 9, "smbopen NdpFileEASet %d. pFEAList->cbList %d\n", rc1, pFEAList->cbList);1682 debuglocal(pRes, 9, "smbopen NdpFileEASet %d. pFEAList->cbList %d\n", rc1, pFEAList->cbList); 1647 1683 } 1648 1684 … … 1690 1726 ENTER(); 1691 1727 1692 debuglocal( 9, "NdpSetFileAttribute in [%p]\n", pConn);1728 debuglocal(pRes, 9, "NdpSetFileAttribute in [%p]\n", pConn); 1693 1729 do { 1694 1730 rc = pathparser(pRes, pConn, szFileName, path); … … 1699 1735 strncpy(finfo.fname, path, sizeof(finfo.fname) - 1); 1700 1736 finfo.attr = usAttr & 0x37; 1701 rc = smbwrp_setattr(p Conn->cli, &finfo);1737 rc = smbwrp_setattr(pRes, pConn->cli, &finfo); 1702 1738 } while (0); 1703 1739 1704 debuglocal( 9, "NdpSetFileAttribute <%s> (%s) %04x %d\n", szFileName, path, usAttr, rc);1740 debuglocal(pRes, 9, "NdpSetFileAttribute <%s> (%s) %04x %d\n", szFileName, path, usAttr, rc); 1705 1741 1706 1742 LEAVE(); … … 1710 1746 int APIENTRY NdpFlush (HRESOURCE resource) 1711 1747 { 1712 debuglocal(9, "NdpFlush %d\n", ERROR_NOT_SUPPORTED); 1748 Resource *pRes = (Resource *)resource; 1749 debuglocal(pRes, 9, "NdpFlush %d\n", ERROR_NOT_SUPPORTED); 1713 1750 return ERROR_NOT_SUPPORTED; 1714 1751 } … … 1722 1759 int APIENTRY NdpIOCTL (int type, HRESOURCE resource, char *path, int function, void *in, ULONG insize, PULONG poutlen) 1723 1760 { 1761 Resource *pRes = (Resource *)resource; 1724 1762 if (function == ND_PL_INIT_THREAD) 1725 1763 { 1726 1764 smbwrp_initthread(); 1727 debuglocal( 9, "NdpIOCTL init thread\n");1765 debuglocal(pRes, 9, "NdpIOCTL init thread\n"); 1728 1766 return NO_ERROR; 1729 1767 } 1730 1768 1731 debuglocal( 9, "NdpIOCTL <%s> %d\n", path, function);1769 debuglocal(pRes, 9, "NdpIOCTL <%s> %d\n", path, function); 1732 1770 1733 1771 if (in && insize > 4096) … … 1753 1791 ENTER(); 1754 1792 1755 debuglocal( 9, "NdpFileQueryInfo in [%p]\n", pConn);1793 debuglocal(pRes, 9, "NdpFileQueryInfo in [%p]\n", pConn); 1756 1794 do { 1757 1795 if (pConn->file.fd < 0 || !*pConn->file.fname) … … 1761 1799 } 1762 1800 strncpy(finfo.fname, pConn->file.fname, sizeof(finfo.fname) - 1); 1763 rc = smbwrp_fgetattr(p Conn->cli, &pConn->file, &finfo);1801 rc = smbwrp_fgetattr(pRes, pConn->cli, &pConn->file, &finfo); 1764 1802 if (!rc) 1765 1803 { … … 1769 1807 } while (0); 1770 1808 1771 debuglocal( 9, "NdpFileQueryInfo <%s> %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, rc);1809 debuglocal(pRes, 9, "NdpFileQueryInfo <%s> %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, rc); 1772 1810 1773 1811 LEAVE(); … … 1789 1827 return ERROR_EAS_NOT_SUPPORTED; 1790 1828 1791 debuglocal( 9, "NdpFileEAQuery in [%p] <%s>/%d pGEAList=%08x\n", pConn, pConn->file.fname, pConn->file.fd, pGEAList);1829 debuglocal(pRes, 9, "NdpFileEAQuery in [%p] <%s>/%d pGEAList=%08x\n", pConn, pConn->file.fname, pConn->file.fd, pGEAList); 1792 1830 1793 1831 char *pchBuffer = (char *)malloc(cbBuffer); … … 1803 1841 break; 1804 1842 } 1805 rc = smbwrp_flistea(p Conn->cli, &pConn->file, pchBuffer, cbBuffer);1843 rc = smbwrp_flistea(pRes, pConn->cli, &pConn->file, pchBuffer, cbBuffer); 1806 1844 pFEASrc = (FEALIST *)pchBuffer; 1807 1845 if (rc) … … 1822 1860 } 1823 1861 else 1824 rc = buildFEALIST(p FEASrc, pGEAList, pFEAList);1862 rc = buildFEALIST(pRes, pFEASrc, pGEAList, pFEAList); 1825 1863 1826 1864 } while (0); 1827 1865 1828 1866 free(pchBuffer); 1829 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);1867 debuglocal(pRes, 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); 1830 1868 1831 1869 LEAVE(); … … 1840 1878 unsigned long action; 1841 1879 1842 debuglocal( 9, "NdpFileEASet in [%p]\n", pConn);1880 debuglocal(pRes, 9, "NdpFileEASet in [%p]\n", pConn); 1843 1881 1844 1882 if (!pFEAList || pFEAList->cbList <= sizeof(long)) … … 1863 1901 while (done < pFEAList->cbList) 1864 1902 { 1865 rc = smbwrp_fsetea(p Conn->cli, &pConn->file, (char *)(pfea + 1), pfea->cbValue ? (char *)(pfea + 1) + pfea->cbName + 1: NULL, pfea->cbValue);1903 rc = smbwrp_fsetea(pRes, pConn->cli, &pConn->file, (char *)(pfea + 1), pfea->cbValue ? (char *)(pfea + 1) + pfea->cbName + 1: NULL, pfea->cbValue); 1866 1904 if (rc) 1867 1905 break; … … 1873 1911 } while (0); 1874 1912 1875 debuglocal( 9, "NdpFileEASet %d\n", rc);1913 debuglocal(pRes, 9, "NdpFileEASet %d\n", rc); 1876 1914 1877 1915 LEAVE(); … … 1895 1933 return ERROR_EAS_NOT_SUPPORTED; 1896 1934 1897 debuglocal( 9, "NdpFileEASize in [%p] <%s>/%d \n", pConn, pConn->file.fname, pConn->file.fd);1935 debuglocal(pRes, 9, "NdpFileEASize in [%p] <%s>/%d \n", pConn, pConn->file.fname, pConn->file.fd); 1898 1936 1899 1937 char *pchBuffer = (char *)malloc(cbBuffer); … … 1909 1947 break; 1910 1948 } 1911 rc = smbwrp_flistea(p Conn->cli, &pConn->file, pchBuffer, cbBuffer);1949 rc = smbwrp_flistea(pRes, pConn->cli, &pConn->file, pchBuffer, cbBuffer); 1912 1950 pFEAList = (FEALIST*)pchBuffer; 1913 1951 if (rc) … … 1929 1967 1930 1968 free(pchBuffer); 1931 debuglocal( 9, "NdpFileEASize %d %d\n", *pulEASize, rc);1969 debuglocal(pRes, 9, "NdpFileEASize %d %d\n", *pulEASize, rc); 1932 1970 1933 1971 LEAVE(); … … 1944 1982 ENTER(); 1945 1983 1946 debuglocal( 9, "NdpFileSetInfo in [%p]\n", pConn);1984 debuglocal(pRes, 9, "NdpFileSetInfo in [%p]\n", pConn); 1947 1985 1948 1986 // delete the dir cache 1949 dircache_invalidate(pConn->file.fullname, pRes ->pdc, 1);1987 dircache_invalidate(pConn->file.fullname, pRes, 1); 1950 1988 1951 1989 do { … … 1958 1996 // deferred setinfo - on closing the file 1959 1997 pConn->file.openattr = attrFile; 1960 fsphDosDateToUnixTime(p fi->stat.fdateLastWrite, pfi->stat.ftimeLastWrite, &(pConn->file.mtime));1961 fsphDosDateToUnixTime(p fi->stat.fdateCreation, pfi->stat.ftimeCreation, &(pConn->file.ctime));1998 fsphDosDateToUnixTime(pRes, pfi->stat.fdateLastWrite, pfi->stat.ftimeLastWrite, &(pConn->file.mtime)); 1999 fsphDosDateToUnixTime(pRes, pfi->stat.fdateCreation, pfi->stat.ftimeCreation, &(pConn->file.ctime)); 1962 2000 pConn->file.updatetime = 2; 1963 debuglocal( 9, "NdpFileSetInfo mtime %d\n", pConn->file.mtime);2001 debuglocal(pRes, 9, "NdpFileSetInfo mtime %d\n", pConn->file.mtime); 1964 2002 } while (0); 1965 2003 1966 debuglocal( 9, "NdpFileSetInfo <%s> %08x %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, attrFile, rc);2004 debuglocal(pRes, 9, "NdpFileSetInfo <%s> %08x %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, attrFile, rc); 1967 2005 1968 2006 LEAVE(); … … 1979 2017 ENTER(); 1980 2018 1981 debuglocal( 9, "NdpFileSetFilePtrL in [%p]\n", pConn);2019 debuglocal(pRes, 9, "NdpFileSetFilePtrL in [%p]\n", pConn); 1982 2020 1983 2021 do { … … 1988 2026 } 1989 2027 1990 rc = smbwrp_lseek(p Conn->cli, &pConn->file, ulMethod, llOffset);2028 rc = smbwrp_lseek(pRes, pConn->cli, &pConn->file, ulMethod, llOffset); 1991 2029 if (!rc) 1992 2030 *pllActual = pConn->file.offset; … … 1994 2032 } while (0); 1995 2033 1996 debuglocal( 9, "NdpFileSetFilePtrL <%s> %lld %lu %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llOffset, ulMethod, *pllActual, rc);2034 debuglocal(pRes, 9, "NdpFileSetFilePtrL <%s> %lld %lu %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llOffset, ulMethod, *pllActual, rc); 1997 2035 1998 2036 LEAVE(); … … 2002 2040 int APIENTRY NdpFileSetFilePtr (HCONNECTION conn, NDFILEHANDLE handle, LONG lOffset, ULONG ulMethod, ULONG *pulActual) 2003 2041 { 2042 Connection *pConn = (Connection *)conn; 2004 2043 LONGLONG llActual; 2005 2044 int rc = NdpFileSetFilePtrL(conn, handle, lOffset, ulMethod, &llActual); 2006 2045 *pulActual = llActual & 0xFFFFFFFF; 2007 debuglocal( 9, "NdpFileSetFilePtr %ld %lu %ld %d\n", lOffset, ulMethod, *pulActual, rc);2046 debuglocal(pConn->pRes, 9, "NdpFileSetFilePtr %ld %lu %ld %d\n", lOffset, ulMethod, *pulActual, rc); 2008 2047 return rc; 2009 2048 } … … 2018 2057 ENTER(); 2019 2058 2020 debuglocal( 9, "NdpFileClose in [%p] %d <%s>\n", pConn, pConn->file.fd, pConn->file.fd < 0 ? "!null!" : pConn->file.fname);2059 debuglocal(pRes, 9, "NdpFileClose in [%p] %d <%s>\n", pConn, pConn->file.fd, pConn->file.fd < 0 ? "!null!" : pConn->file.fname); 2021 2060 2022 2061 do { … … 2027 2066 } 2028 2067 2029 rc = smbwrp_close(p Conn->cli, &pConn->file);2068 rc = smbwrp_close(pRes, pConn->cli, &pConn->file); 2030 2069 2031 2070 } while (0); 2032 2071 2033 debuglocal( 9, "NdpFileClose %d %d\n", pConn->file.fd, rc);2072 debuglocal(pRes, 9, "NdpFileClose %d %d\n", pConn->file.fd, rc); 2034 2073 pConn->file.fd = -1; 2035 2074 … … 2040 2079 int APIENTRY NdpFileCommit (HCONNECTION conn, NDFILEHANDLE handle) 2041 2080 { 2042 debuglocal(9, "NdpFileCommit %d\n", NO_ERROR); 2081 Connection *pConn = (Connection *)conn; 2082 debuglocal(pConn->pRes, 9, "NdpFileCommit %d\n", NO_ERROR); 2043 2083 return NO_ERROR; 2044 2084 } … … 2046 2086 int APIENTRY NdpFileNewSize (HCONNECTION conn, NDFILEHANDLE handle, ULONG ulLen) 2047 2087 { 2088 Connection *pConn = (Connection *)conn; 2048 2089 int rc = NdpFileNewSizeL(conn, handle, ulLen); 2049 debuglocal( 9, "NdpFileNewSize %ld %d\n", ulLen, rc);2090 debuglocal(pConn->pRes, 9, "NdpFileNewSize %ld %d\n", ulLen, rc); 2050 2091 return rc; 2051 2092 } … … 2060 2101 ENTER(); 2061 2102 2062 debuglocal( 9, "NdpFileNewSizeL in [%p]\n", pConn);2103 debuglocal(pRes, 9, "NdpFileNewSizeL in [%p]\n", pConn); 2063 2104 2064 2105 do { … … 2069 2110 } 2070 2111 2071 rc = smbwrp_setfilesize(p Conn->cli, &pConn->file, llLen);2112 rc = smbwrp_setfilesize(pRes, pConn->cli, &pConn->file, llLen); 2072 2113 2073 2114 } while (0); 2074 2115 2075 debuglocal( 9, "NdpFileNewSizeL <%s> %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llLen, rc);2116 debuglocal(pRes, 9, "NdpFileNewSizeL <%s> %lld %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, llLen, rc); 2076 2117 2077 2118 LEAVE(); … … 2093 2134 ENTER(); 2094 2135 2095 debuglocal( 9, "NdpFileRead in [%p]\n", pConn);2136 debuglocal(pRes, 9, "NdpFileRead in [%p]\n", pConn); 2096 2137 2097 2138 do { … … 2106 2147 ULONG ulActual; 2107 2148 ULONG ulToRead = ulRead - ulReadCompleted; 2108 debuglocal( 9, "NdpFileRead completed %d, to read %d\n", ulReadCompleted, ulToRead);2149 debuglocal(pRes, 9, "NdpFileRead completed %d, to read %d\n", ulReadCompleted, ulToRead); 2109 2150 2110 2151 if (ulToRead > NDPSMB_READ_MAX_SIZE) 2111 2152 ulToRead = NDPSMB_READ_MAX_SIZE; 2112 2153 2113 rc = smbwrp_read(p Conn->cli, &pConn->file, (char *)pBuffer + ulReadCompleted, ulToRead, &ulActual);2154 rc = smbwrp_read(pRes, pConn->cli, &pConn->file, (char *)pBuffer + ulReadCompleted, ulToRead, &ulActual); 2114 2155 if (ulActual == 0 || rc != NO_ERROR) 2115 2156 break; … … 2125 2166 *pulActual = ulReadCompleted; 2126 2167 2127 debuglocal( 9, "NdpFileRead <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulRead, *pulActual, rc);2168 debuglocal(pRes, 9, "NdpFileRead <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulRead, *pulActual, rc); 2128 2169 2129 2170 LEAVE(); … … 2142 2183 ENTER(); 2143 2184 2144 debuglocal( 9, "NdpFileWrite in [%p]\n", pConn);2185 debuglocal(pRes, 9, "NdpFileWrite in [%p]\n", pConn); 2145 2186 2146 2187 /* … … 2151 2192 * a new function needs to be done to update only one file in the cache 2152 2193 */ 2153 dircache_invalidate(pConn->file.fullname, pRes ->pdc, 1);2194 dircache_invalidate(pConn->file.fullname, pRes, 1); 2154 2195 2155 2196 do { … … 2159 2200 break; 2160 2201 } 2161 rc = smbwrp_write(p Conn->cli, &pConn->file, pBuffer, ulWrite, pulActual);2202 rc = smbwrp_write(pRes, pConn->cli, &pConn->file, pBuffer, ulWrite, pulActual); 2162 2203 2163 2204 } while (0); 2164 2205 2165 debuglocal( 9, "NdpFileWrite <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulWrite, *pulActual, rc);2166 2167 LEAVE(); 2168 return rc; 2169 } 2206 debuglocal(pRes, 9, "NdpFileWrite <%s> %lu %lu %d\n", pConn->file.fd < 0 ? "!null!" : pConn->file.fname, ulWrite, *pulActual, rc); 2207 2208 LEAVE(); 2209 return rc; 2210 } -
trunk/client/src/rc/rc.dlg
r519 r960 6 6 DLGTEMPLATE DLG_ID LOADONCALL MOVEABLE DISCARDABLE 7 7 BEGIN 8 DIALOG "", DLG_ID, 24, 44, 253, 187, WS_VISIBLE, FCF_SYSMENU |8 DIALOG "", DLG_ID, 24, 44, 253, 216, WS_VISIBLE, FCF_SYSMENU | 9 9 FCF_TITLEBAR 10 10 BEGIN 11 CTEXT "SMB resource properties:", LBL_PROP, 197, 1 51, 12,11 CTEXT "SMB resource properties:", LBL_PROP, 197, 180, 12, 12 12 10, DT_VCENTER | NOT WS_VISIBLE 13 LTEXT "Workgroup:", LBL_WORKGRP, 13, 161, 52, 10, 13 GROUPBOX "CIFS/SMB resource properties", GB_PROPERTIES, 5, 152, 14 244, 58 15 PRESPARAMS PP_FOREGROUNDCOLOR, 0x00000000L 16 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold" 17 LTEXT "Workgroup:", LBL_WORKGRP, 13, 192, 52, 10, 14 18 DT_BOTTOM 15 ENTRYFIELD "", ENT_WORKGRP, 71, 163, 100, 8, ES_MARGIN 16 LTEXT "Server:", LBL_SERVER, 13, 146, 52, 10, DT_BOTTOM 17 ENTRYFIELD "", ENT_SERVER, 71, 148, 100, 8, ES_MARGIN 18 LTEXT "Share:", LBL_SHARE, 13, 132, 52, 10, DT_BOTTOM 19 ENTRYFIELD "", ENT_SHARE, 71, 133, 100, 8, ES_MARGIN 20 LTEXT "User ID:", LBL_USER, 13, 100, 53, 10, DT_BOTTOM 21 ENTRYFIELD "", ENT_USER, 71, 102, 100, 8, ES_MARGIN 22 LTEXT "Password:", LBL_PASS, 13, 87, 53, 10, DT_BOTTOM 23 ENTRYFIELD "", ENT_PASS, 71, 88, 100, 8, ES_MARGIN | 19 ENTRYFIELD "", ENT_WORKGRP, 71, 192, 100, 8, ES_MARGIN 20 LTEXT "Server:", LBL_SERVER, 13, 177, 52, 10, DT_BOTTOM 21 ENTRYFIELD "", ENT_SERVER, 71, 177, 100, 8, ES_MARGIN 22 LTEXT "Share:", LBL_SHARE, 13, 161, 52, 10, DT_BOTTOM 23 ENTRYFIELD "", ENT_SHARE, 71, 161, 100, 8, ES_MARGIN 24 LTEXT "Supports EA", LBL_EASUPPORT, 195, 159, 52, 10, 25 DT_WORDBREAK 26 AUTOCHECKBOX "", CHK_EASUPPORT, 180, 161, 10, 10, WS_GROUP 27 GROUPBOX "Login as", GB_LOGIN, 5, 111, 244, 40 28 PRESPARAMS PP_FOREGROUNDCOLOR, 0x00000000L 29 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold" 30 LTEXT "User ID:", LBL_USER, 13, 131, 53, 10, DT_BOTTOM 31 ENTRYFIELD "", ENT_USER, 71, 131, 100, 8, ES_MARGIN 32 LTEXT "Password:", LBL_PASS, 13, 117, 53, 10, DT_BOTTOM 33 ENTRYFIELD "", ENT_PASS, 71, 117, 100, 8, ES_MARGIN | 24 34 ES_UNREADABLE 25 ENTRYFIELD "", ENT_SPASS, 180, 88, 56, 8, ES_MARGIN |35 ENTRYFIELD "", ENT_SPASS, 180, 117, 56, 8, ES_MARGIN | 26 36 ES_UNREADABLE | NOT WS_TABSTOP | NOT WS_VISIBLE 27 LTEXT "Master:", LBL_MASTER, 12, 60, 52, 10, DT_BOTTOM 28 CONTROL "", CMB_MASTER, 69, 37, 71, 33, WC_COMBOBOX, 37 GROUPBOX "Browse", GB_BROWSE, 5, 82, 244, 26 38 PRESPARAMS PP_FOREGROUNDCOLOR, 0x00000000L 39 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold" 40 LTEXT "Master:", LBL_MASTER, 12, 89, 52, 10, DT_BOTTOM 41 CONTROL "", CMB_MASTER, 69, 66, 71, 30, WC_COMBOBOX, 29 42 CBS_DROPDOWNLIST | WS_GROUP | WS_TABSTOP | 30 43 WS_VISIBLE 31 ENTRYFIELD "", ENT_MASTER, 147, 60, 90, 8, ES_MARGIN 32 LTEXT "Supports EA", LBL_EASUPPORT, 195, 130, 52, 10, 33 DT_WORDBREAK 34 AUTOCHECKBOX "", CHK_EASUPPORT, 180, 132, 10, 10, WS_GROUP 44 ENTRYFIELD "", ENT_MASTER, 147, 89, 90, 8, ES_MARGIN 45 GROUPBOX "Cache", GB_CACHE, 5, 53, 244, 26 46 PRESPARAMS PP_FOREGROUNDCOLOR, 0x00000000L 47 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold" 48 LTEXT "Cache timeout:", LBL_CACHETIMEOUT, 12, 59, 55, 8, DT_BOTTOM 49 CONTROL "", SPIN_CACHETIMEOUT, 69, 59, 32, 12, WC_SPINBUTTON 50 SPBS_NUMERICONLY | SPBS_JUSTRIGHT | SPBS_MASTER | WS_GROUP | WS_TABSTOP | 51 WS_VISIBLE 52 LTEXT "Cache listings:", LBL_CACHEDEPTH, 134, 59, 55, 8, DT_BOTTOM 53 CONTROL "", SPIN_CACHEDEPTH, 194, 59, 39, 12, WC_SPINBUTTON 54 SPBS_NUMERICONLY | SPBS_JUSTRIGHT | SPBS_MASTER | WS_GROUP | WS_TABSTOP | 55 WS_VISIBLE 56 GROUPBOX "Logging", GB_CACHE, 5, 24, 244, 26 57 PRESPARAMS PP_FOREGROUNDCOLOR, 0x00000000L 58 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold" 59 LTEXT "Loglevel:", LBL_LOGLEVEL, 12, 30, 55, 8, DT_BOTTOM 60 CONTROL "", SPIN_LOGLEVEL, 69, 30, 39, 12, WC_SPINBUTTON 61 SPBS_NUMERICONLY | SPBS_JUSTRIGHT | SPBS_MASTER | WS_GROUP | WS_TABSTOP | 62 WS_VISIBLE 35 63 PUSHBUTTON "Cancel", DID_CANCEL, 7, 6, 56, 14 36 64 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold" … … 41 69 PUSHBUTTON "Help", BTN_HELP, 190, 6, 56, 14, BS_HELP 42 70 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold" 43 GROUPBOX "CIFS/SMB resource properties", GB_PROPERTIES, 5, 125,44 244, 5845 PRESPARAMS PP_FOREGROUNDCOLOR, 0x00000000L46 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold"47 GROUPBOX "Login as", GB_LOGIN, 5, 82, 244, 4048 PRESPARAMS PP_FOREGROUNDCOLOR, 0x00000000L49 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold"50 GROUPBOX "Cache", GB_CACHE, 5, 24, 244, 2651 PRESPARAMS PP_FOREGROUNDCOLOR, 0x00000000L52 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold"53 GROUPBOX "Browse", GB_BROWSE, 5, 53, 244, 2654 PRESPARAMS PP_FOREGROUNDCOLOR, 0x00000000L55 PRESPARAMS PP_FONTNAMESIZE, "9.WarpSans Bold"56 LTEXT "Cache timeout:", LBL_CACHETIMEOUT, 12, 30, 55, 8, DT_BOTTOM57 CONTROL "", SPIN_CACHETIMEOUT, 69, 30, 32, 12, WC_SPINBUTTON58 SPBS_NUMERICONLY | SPBS_JUSTRIGHT | SPBS_MASTER | WS_GROUP | WS_TABSTOP |59 WS_VISIBLE60 LTEXT "Cache listings:", LBL_CACHEDEPTH, 134, 30, 55, 8, DT_BOTTOM61 CONTROL "", SPIN_CACHEDEPTH, 194, 30, 39, 12, WC_SPINBUTTON62 SPBS_NUMERICONLY | SPBS_JUSTRIGHT | SPBS_MASTER | WS_GROUP | WS_TABSTOP |63 WS_VISIBLE64 71 END 65 72 END -
trunk/client/src/rc/rc.h
r519 r960 21 21 #define GB_LOGIN 1024 22 22 #define GB_PROPERTIES 1026 23 #define GB_CACHE 23 #define GB_CACHE 1025 24 24 #define GB_BROWSE 1027 25 #define LBL_CACHETIMEOUT 1014 26 #define SPIN_CACHETIMEOUT 1015 27 #define LBL_CACHEDEPTH 1017 28 #define SPIN_CACHEDEPTH 1018 25 #define LBL_CACHETIMEOUT 1014 26 #define SPIN_CACHETIMEOUT 1015 27 #define LBL_CACHEDEPTH 1017 28 #define SPIN_CACHEDEPTH 1018 29 #define LBL_LOGLEVEL 1019 30 #define SPIN_LOGLEVEL 1020 -
trunk/client/src/rc/rc.rc_
r756 r960 38 38 "Help for command line utility:\r\n" 39 39 "\r\n" 40 "nd mount smbfs s:\\mountpoint ;workgroup=...;server=...;share=...;user=...;password=...;master=...;mastertype=...;easupport=... \r\n"40 "nd mount smbfs s:\\mountpoint ;workgroup=...;server=...;share=...;user=...;password=...;master=...;mastertype=...;easupport=...;loglevel=...\r\n" 41 41 "\r\n" 42 42 " workgroup - name of workgroup\r\n" … … 48 48 " mastertype - 0 if 'master' is the name of master server, 1 if 'master' is the name of master workgroup\r\n" 49 49 " easupport - 0 to not support EA, 1 to support\r\n" 50 " loglevel - 0 no log, 2 standard log, 5 verbose, 10 very big log\r\n" 50 51 "\r\n" 51 52 } … … 126 127 RCDATA (DLG_ID + 11) 127 128 { 129 SPIN_LOGLEVEL, PARMTYPE_INT, 0L, 10L, "loglevel", "%d", 0L 130 } 131 132 RCDATA (DLG_ID + 12) 133 { 128 134 1 129 135 } -
trunk/client/src/smbwrp.c
r959 r960 40 40 } 41 41 42 void smbwrp_Logging() 43 { 44 char slogfile[_MAX_PATH +1] = {0}; 45 char slogfilename[] = "log.smbc"; 46 char *env = getenv("LOGFILES"); 47 if (env != NULL) 48 { 49 strncpy(slogfile, env, sizeof(slogfile) -1); 50 strncat(slogfile, "\\", sizeof(slogfile) - strlen(slogfile) -1); 51 strncat(slogfile, slogfilename, sizeof(slogfile) - strlen(slogfile) -1); 52 } 53 else 54 strncpy(slogfile, slogfilename, sizeof(slogfile) -1); 55 56 // init samba for debug messages 57 setup_logging("ndpsmb", DEBUG_FILE); 58 lp_set_logfile(slogfile); 59 lp_set_cmdline("log level", "10"); 60 reopen_logs(); 42 void smbwrp_Logging(Resource *pRes) 43 { 44 if (pRes && pRes->loglevel > 0) 45 { 46 // init samba for debug messages 47 setup_logging("ndpsmb", DEBUG_FILE); 48 49 char smblevel[3]; 50 itoa(pRes->loglevel, smblevel, 10); 51 lp_set_logfile(pRes->smb_logfile); 52 lp_set_cmdline("log level", smblevel); 53 reopen_logs(); 54 } 61 55 62 56 return; … … 76 70 * initialise structures 77 71 */ 78 int _System smbwrp_init(void) 79 { 80 static int initialised = 0; 72 int _System smbwrp_init(Resource *pRes) 73 { 81 74 char *p; 82 75 83 if ( initialised)76 if (pRes->smb_initialised) 84 77 return 0; 85 78 86 initialised = 1;79 pRes->smb_initialised = 1; 87 80 88 81 lp_set_in_client(true); // Make sure that we tell lp_load we are client … … 91 84 92 85 if (!lp_load(get_dyn_CONFIGFILE(),true,false,false,true)) 93 debuglocal( 0,("The initial smb.conf is missing, defaults are used!\n"));86 debuglocal(pRes, 0,("The initial smb.conf is missing, defaults are used!\n")); 94 87 95 88 load_interfaces(); … … 98 91 return 1; 99 92 100 if (writeLog())101 smbwrp_Logging(); 102 93 smbwrp_Logging(pRes); 94 95 debuglocal(pRes, 5,("smbwrp_init done\n")); 103 96 /* 104 97 if ((p=smbw_getshared("RESOLVE_ORDER"))) … … 116 109 */ 117 110 BlockSignals(True, SIGPIPE); 111 return; 118 112 } 119 113 … … 214 208 * return a connection to a server 215 209 */ 216 int _System smbwrp_connect( 210 int _System smbwrp_connect(Resource* pRes, cli_state ** cli) 217 211 { 218 212 smbwrp_server * srv = &pRes->srv; … … 231 225 zero_sockaddr(&ss); 232 226 233 debuglocal( 1,"Connecting to \\\\%s:*********@%s:%s\\%s. Master %s:%d\n", srv->username, workgroup, server, share, srv->master, srv->ifmastergroup);227 debuglocal(pRes, 1,"Connecting to \\\\%s:*********@%s:%s\\%s. Master %s:%d\n", srv->username, workgroup, server, share, srv->master, srv->ifmastergroup); 234 228 235 229 if (!*server) { … … 273 267 if (pRes->krb5support == 1) 274 268 { 275 debuglocal( 1,"Kerberos support enabled\n");269 debuglocal(pRes, 1,"Kerberos support enabled\n"); 276 270 c->use_kerberos = True; 277 271 } … … 289 283 } 290 284 291 debuglocal( 4,"session request ok\n");285 debuglocal(pRes, 4,"session request ok\n"); 292 286 293 287 if (!NT_STATUS_IS_OK(cli_negprot(c))) { … … 296 290 } 297 291 298 debuglocal( 4,"session setuping for <%s>/<********> in <%s> %08x %08x %08x\n", srv->username, workgroup, c->protocol, c->sec_mode, c->capabilities);292 debuglocal(pRes, 4,"session setuping for <%s>/<********> in <%s> %08x %08x %08x\n", srv->username, workgroup, c->protocol, c->sec_mode, c->capabilities); 299 293 300 294 if (!NT_STATUS_IS_OK(cli_session_setup(c, srv->username, … … 303 297 workgroup))) 304 298 { 305 debuglocal( 4,"%s/******** login failed\n", srv->username);299 debuglocal(pRes, 4,"%s/******** login failed\n", srv->username); 306 300 loginerror = 1; // save the login error 307 301 308 302 // try an anonymous login if it failed 309 303 if (!NT_STATUS_IS_OK(cli_session_setup(c, "", "", 0,"", 0, workgroup))) { 310 debuglocal( 4,"Anonymous login failed\n");304 debuglocal(pRes, 4,"Anonymous login failed\n"); 311 305 cli_shutdown(c); 312 306 return 6; 313 307 } 314 debuglocal( 4,"Anonymous login successful\n");308 debuglocal(pRes, 4,"Anonymous login successful\n"); 315 309 status = cli_init_creds(c, "", lp_workgroup(), ""); 316 310 } else { … … 319 313 320 314 if (!NT_STATUS_IS_OK(status)) { 321 debuglocal( 4,"cli_init_creds() failed\n");315 debuglocal(pRes, 4,"cli_init_creds() failed\n"); 322 316 cli_shutdown(c); 323 317 // if loginerror is != 0 means normal login failed, but anonymous login worked … … 328 322 } 329 323 330 debuglocal( 4,"session setup ok. Sending tconx <%s> <********>\n", share);324 debuglocal(pRes, 4,"session setup ok. Sending tconx <%s> <********>\n", share); 331 325 332 326 // YD ticket:58 we need to check resource type to avoid connecting to printers. … … 348 342 } 349 343 350 debuglocal( 4,"tconx ok. cli caps %08x\n", c->capabilities);344 debuglocal(pRes, 4,"tconx ok. cli caps %08x\n", c->capabilities); 351 345 352 346 // save cli_state pointer … … 359 353 * close a connection to a server 360 354 */ 361 void _System smbwrp_disconnect( 355 void _System smbwrp_disconnect(Resource* pRes, cli_state * cli) 362 356 { 363 357 // this call will free all buffers, close handles and free cli mem … … 369 363 * a wrapper for open() 370 364 */ 371 int _System smbwrp_open( cli_state * cli, smbwrp_file * file)365 int _System smbwrp_open(Resource *pRes, cli_state * cli, smbwrp_file * file) 372 366 { 373 367 uint16_t fd = 0; … … 379 373 file->denymode = DENY_NONE; 380 374 381 debuglocal( 4,"cli_open(%s) attr %08x mode %02x denymode %02x\n", file->fname, file->openattr, file->openmode, file->denymode);375 debuglocal(pRes, 4,"cli_open(%s) attr %08x mode %02x denymode %02x\n", file->fname, file->openattr, file->openmode, file->denymode); 382 376 if (!NT_STATUS_IS_OK(cli_open(cli, file->fname, file->openmode, file->denymode, &fd))) 383 377 return os2cli_errno(cli); … … 392 386 * a wrapper for read() 393 387 */ 394 int _System smbwrp_read( cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result)388 int _System smbwrp_read(Resource *pRes, cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result) 395 389 { 396 390 int ret; … … 412 406 * a wrapper for write() 413 407 */ 414 int _System smbwrp_write( cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result)408 int _System smbwrp_write(Resource *pRes, cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result) 415 409 { 416 410 NTSTATUS status; … … 421 415 422 416 *result = 0; 423 //debuglocal(1,("Write %x %d %lld %d", cli, file->fd, file->offset, count));417 debuglocal(pRes, 10, "Write %x %d %lld %d\n", cli, file->fd, file->offset, count); 424 418 status = cli_writeall(cli, file->fd, 0, buf, file->offset, count, &ret); 425 419 if (!NT_STATUS_IS_OK(status)) … … 435 429 * a wrapper for close() 436 430 */ 437 int _System smbwrp_close( cli_state * cli, smbwrp_file * file)431 int _System smbwrp_close(Resource *pRes, cli_state * cli, smbwrp_file * file) 438 432 { 439 433 int rc = 0; … … 441 435 return maperror(EINVAL); 442 436 443 debuglocal( 4,"smpwrp_close updatetime: %d\n", file->updatetime);437 debuglocal(pRes, 4,"smpwrp_close updatetime: %d\n", file->updatetime); 444 438 445 439 if (file->updatetime == 1) 446 440 { 447 441 file->mtime = time(NULL); 448 debuglocal( 4,"cli_close new mtime %lu\n", file->mtime);442 debuglocal(pRes, 4,"cli_close new mtime %lu\n", file->mtime); 449 443 } 450 444 … … 454 448 if (!rc && (file->openattr || file->mtime || file->ctime)) 455 449 { 456 debuglocal(4,"Set pathinfo on close %s %08x %d %d\n", file->fname, file->openattr, file->mtime, file->ctime); 457 if (!NT_STATUS_IS_OK(cli_setpathinfo_basic(cli, file->fname, file->ctime, 0, file->mtime, 0, file->openattr))) 458 debuglocal(4,"Set pathinfo on close failed %d\n", os2cli_errno(cli)); 450 debuglocal(pRes, 4,"Set pathinfo on close %s %08x %d %d\n", file->fname, file->openattr, file->mtime, file->ctime); 451 if (!NT_STATUS_IS_OK(cli_setpathinfo_basic(cli, file->fname, file->ctime, 0, file->mtime, 0, file->openattr))) 452 { 453 debuglocal(pRes, 4,"Set pathinfo on close failed %d\n", os2cli_errno(cli)); 454 } 459 455 } 460 456 … … 469 465 } 470 466 471 int _System smbwrp_setfilesize( cli_state * cli, smbwrp_file * file, long long newsize)467 int _System smbwrp_setfilesize(Resource *pRes, cli_state * cli, smbwrp_file * file, long long newsize) 472 468 { 473 469 int rc = 0; … … 475 471 return maperror(EINVAL); 476 472 477 debuglocal( 4,"cli_setnewfilesize(%s) %lld\n", file->fname, newsize);473 debuglocal(pRes, 4,"cli_setnewfilesize(%s) %lld\n", file->fname, newsize); 478 474 if (!NT_STATUS_IS_OK(cli_ftruncate(cli, file->fd, newsize))) 479 475 { … … 489 485 file->openmode &= ~(O_CREAT | O_EXCL); 490 486 file->openmode |= O_TRUNC; 491 debuglocal( 4,"cli_setnewfileszie : cli_open(%s) attr %08x mode %02x denymode %02x\n", file->fname, file->openattr, file->openmode, file->denymode);487 debuglocal(pRes, 4,"cli_setnewfileszie : cli_open(%s) attr %08x mode %02x denymode %02x\n", file->fname, file->openattr, file->openmode, file->denymode); 492 488 if (!NT_STATUS_IS_OK(cli_open(cli, file->fname, file->openmode, file->denymode, &fd))) 493 489 return os2cli_errno(cli); … … 501 497 * a wrapper for rename() 502 498 */ 503 int _System smbwrp_rename( cli_state * cli, char *oldname, char *newname)499 int _System smbwrp_rename(Resource *pRes, cli_state * cli, char *oldname, char *newname) 504 500 { 505 501 if (!cli || !oldname || !newname) 506 502 return maperror(EINVAL); 507 503 508 debuglocal( 1,"Rename <%s> -> <%s>\n", oldname, newname);504 debuglocal(pRes, 4,"Rename <%s> -> <%s>\n", oldname, newname); 509 505 if (!NT_STATUS_IS_OK(cli_rename(cli, oldname, newname))) 510 506 return os2cli_errno(cli); … … 517 513 * a wrapper for chmod() 518 514 */ 519 int _System smbwrp_setattr( cli_state * cli, smbwrp_fileinfo *finfo)515 int _System smbwrp_setattr(Resource *pRes, cli_state * cli, smbwrp_fileinfo *finfo) 520 516 { 521 517 if (!cli || !finfo || !*finfo->fname) 522 518 return maperror(EINVAL); 523 519 524 debuglocal( 4,"Setting on <%s> attr %04x, time %lu (timezone /%lu\n", finfo->fname, finfo->attr, finfo->mtime, finfo->mtime + get_time_zone(finfo->mtime));520 debuglocal(pRes, 4,"Setting on <%s> attr %04x, time %lu (timezone /%lu\n", finfo->fname, finfo->attr, finfo->mtime, finfo->mtime + get_time_zone(finfo->mtime)); 525 521 // we already have gmt time, so no need to add timezone 526 522 // if (!cli_setatr(cli, finfo->fname, finfo->attr, finfo->mtime + (finfo->mtime == 0 ? 0 : get_time_zone(finfo->mtime))) … … 535 531 * a wrapper for unlink() 536 532 */ 537 int _System smbwrp_unlink( cli_state * cli, const char *fname)533 int _System smbwrp_unlink(Resource *pRes, cli_state * cli, const char *fname) 538 534 { 539 535 if (!cli || !fname) … … 561 557 * a wrapper for lseek() 562 558 */ 563 int _System smbwrp_lseek( cli_state * cli, smbwrp_file * file, int whence, long long offset)559 int _System smbwrp_lseek(Resource *pRes, cli_state * cli, smbwrp_file * file, int whence, long long offset) 564 560 { 565 561 off_t size; … … 567 563 return maperror(EINVAL); 568 564 569 debuglocal( 4,"lseek %d %lld %lld\n", whence, offset, file->offset);565 debuglocal(pRes, 4,"lseek %d %lld %lld\n", whence, offset, file->offset); 570 566 571 567 switch (whence) { … … 599 595 * this is needed because win95 sometimes refuses the qpathinfo 600 596 */ 601 int _System smbwrp_getattr( smbwrp_server *srv, cli_state * cli, smbwrp_fileinfo *finfo)597 int _System smbwrp_getattr(Resource *pRes, smbwrp_server *srv, cli_state * cli, smbwrp_fileinfo *finfo) 602 598 { 603 599 SMB_INO_T ino = 0; … … 609 605 return maperror(EINVAL); 610 606 611 debuglocal( 4,"getattr %d %d <%s>\n", cli->capabilities & CAP_NOPATHINFO2, cli->capabilities & CAP_NT_SMBS, finfo->fname);607 debuglocal(pRes, 4,"getattr %d %d <%s>\n", cli->capabilities & CAP_NOPATHINFO2, cli->capabilities & CAP_NT_SMBS, finfo->fname); 612 608 if (!(cli->capabilities & CAP_NOPATHINFO2) && 613 609 NT_STATUS_IS_OK(cli_qpathinfo2(cli, finfo->fname, &ctime, &atime, … … 636 632 || (strncmp(cli->dev,"LPT",3) == 0)) 637 633 { 638 debuglocal( 4,"getattr not a share.\n");634 debuglocal(pRes, 4,"getattr not a share.\n"); 639 635 *(time_t *)&finfo->ctime = time (NULL); 640 636 *(time_t *)&finfo->atime = time (NULL); … … 663 659 if (NT_STATUS_IS_OK(cli_getatr(cli, finfo->fname, (unsigned short *)&finfo->attr, &finfo->size, (time_t *)&finfo->mtime))) 664 660 { 665 //debuglocal(2,("gotattr1 %08x <%s>\n", finfo->attr, finfo->fname));661 debuglocal(pRes, 10,("gotattr1 %08x <%s>\n", finfo->attr, finfo->fname)); 666 662 finfo->mtime -= get_time_zone(finfo->mtime); 667 663 finfo->atime = finfo->atime; //was mtime … … 678 674 * this is needed because win95 sometimes refuses the qpathinfo 679 675 */ 680 int _System smbwrp_fgetattr( cli_state * cli, smbwrp_file *file, smbwrp_fileinfo *finfo)676 int _System smbwrp_fgetattr(Resource *pRes, cli_state * cli, smbwrp_file *file, smbwrp_fileinfo *finfo) 681 677 { 682 678 struct timespec ctime; … … 725 721 if (state && finfo) 726 722 { 727 filelist_state * 723 filelist_state *st = (filelist_state *)state; 728 724 char fullname[ _MAX_PATH] = {0}; 729 debuglocal( 8,"adding <%s> %d %d %d\n", finfo->fname, sizeof(st->finfo), st->datalen, sizeof(st->finfo.fname));725 debuglocal(st->pConn->pRes, 8,"adding <%s> %d %d %d\n", finfo->fname, sizeof(st->finfo), st->datalen, sizeof(st->finfo.fname)); 730 726 memcpy(&st->finfo, finfo, sizeof(st->finfo)); 731 727 strncpy(fullname, st->dir, strlen(st->dir)); 732 728 strncat(fullname, finfo->fname, sizeof(fullname) - strlen(fullname) -1); 733 729 strncpy(st->finfo.fname, fullname, sizeof(st->finfo.fname)); 734 getfindinfoL( 730 getfindinfoL(st->pConn, st->plist, &st->finfo, st->ulAttribute, st->dir_mask); 735 731 } 736 732 return; … … 796 792 static int list_files(struct cli_state *cli, const char *mask, uint16 attribute, 797 793 void (*fn)(const char *, smbwrp_fileinfo *, const char *, 798 void *), void*state)794 void *), filelist_state *state) 799 795 { 800 796 TALLOC_CTX *frame = talloc_stackframe(); … … 807 803 void *dircachectx = NULL; 808 804 smbwrp_fileinfo wrpfinfo; 805 Resource *pRes = state->pConn->pRes; 809 806 810 807 // Try to get the listing from cache. … … 826 823 ? SMB_FIND_FILE_BOTH_DIRECTORY_INFO : SMB_FIND_EA_SIZE; 827 824 828 debuglocal( 4,"list_files level %d. mask <%s>\n", info_level, mask);825 debuglocal(pRes, 4,"list_files level %d. mask <%s>\n", info_level, mask); 829 826 830 827 req = cli_list_send(frame, ev, cli, mask, attribute, info_level); … … 843 840 dircachectx = dircache_write_begin(state, num_finfo); 844 841 845 debuglocal( 4,"list_files: got %d files\n", num_finfo);842 debuglocal(pRes, 4,"list_files: got %d files\n", num_finfo); 846 843 847 844 for (i=0; i<num_finfo; i++) { … … 857 854 fn(cli->dfs_mountpoint, &wrpfinfo, mask, state); 858 855 // Also add the entry to the cache. 859 dircache_write_entry( dircachectx, &wrpfinfo);860 } 861 862 dircache_write_end( dircachectx);856 dircache_write_entry(pRes, dircachectx, &wrpfinfo); 857 } 858 859 dircache_write_end(pRes, dircachectx); 863 860 fail: 864 861 TALLOC_FREE(frame); … … 869 866 * open a directory on the server 870 867 */ 871 int _System smbwrp_filelist( smbwrp_server *srv, cli_state * cli, filelist_state * state)868 int _System smbwrp_filelist(Resource *pRes, smbwrp_server *srv, cli_state * cli, filelist_state * state) 872 869 { 873 870 if (!srv || !cli || !state || !*state->mask) 874 871 return maperror(EINVAL); 875 872 876 debuglocal( 1,"Filelist <%s> on master <%s> wgrp <%s> server <%s> share <%s> clidev <%s>\n", state->mask, srv->master, srv->workgroup, srv->server_name, srv->share_name, cli->dev);873 debuglocal(pRes, 1,"Filelist <%s> on master <%s> wgrp <%s> server <%s> share <%s> clidev <%s>\n", state->mask, srv->master, srv->workgroup, srv->server_name, srv->share_name, cli->dev); 877 874 if (*srv->workgroup == 0 && *srv->server_name == 0) 878 875 { … … 915 912 * a wrapper for chdir() 916 913 */ 917 int _System smbwrp_chdir( smbwrp_server *srv, cli_state * cli, char *fname)914 int _System smbwrp_chdir(Resource *pRes, smbwrp_server *srv, cli_state * cli, char *fname) 918 915 { 919 916 unsigned short mode = aDIR; … … 923 920 924 921 strncpy(finfo.fname, fname, sizeof(finfo.fname) - 1); 925 if (smbwrp_getattr( srv, cli, &finfo))922 if (smbwrp_getattr(pRes, srv, cli, &finfo)) 926 923 return os2cli_errno(cli); 927 924 … … 938 935 * a wrapper for mkdir() 939 936 */ 940 int _System smbwrp_mkdir( cli_state * cli, char *fname)937 int _System smbwrp_mkdir(Resource *pRes, cli_state * cli, char *fname) 941 938 { 942 939 if (!cli || !fname) … … 952 949 * a wrapper for rmdir() 953 950 */ 954 int _System smbwrp_rmdir( cli_state * cli, char *fname)951 int _System smbwrp_rmdir(Resource *pRes, cli_state * cli, char *fname) 955 952 { 956 953 if (!cli || !fname) … … 966 963 * set EA for a path 967 964 */ 968 int _System smbwrp_setea( cli_state * cli, char *fname, char * name, unsigned char * value, int size)965 int _System smbwrp_setea(Resource *pRes, cli_state * cli, char *fname, char * name, unsigned char * value, int size) 969 966 { 970 967 if (!cli || !fname || !name) … … 980 977 * set EA for a file 981 978 */ 982 int _System smbwrp_fsetea( cli_state * cli, smbwrp_file *file, char * name, unsigned char * value, int size)979 int _System smbwrp_fsetea(Resource *pRes, cli_state * cli, smbwrp_file *file, char * name, unsigned char * value, int size) 983 980 { 984 981 if (!cli || !file || !name) … … 1007 1004 #pragma pack() 1008 1005 1009 static int unilistea( cli_state * cli, char *fname, void * buffer, unsigned long size)1006 static int unilistea(Resource *pRes, cli_state * cli, char *fname, void * buffer, unsigned long size) 1010 1007 { 1011 1008 int fnum, i; … … 1024 1021 if (!NT_STATUS_IS_OK(cli_get_ea_list_path(cli, fname, mem_ctx, &num_eas, &ea_list))) 1025 1022 { 1026 debuglocal( 4,"ea_get_file list failed - %s\n", cli_errstr(cli));1023 debuglocal(pRes, 4,"ea_get_file list failed - %s\n", cli_errstr(cli)); 1027 1024 talloc_destroy(mem_ctx); 1028 1025 return os2cli_errno(cli); 1029 1026 } 1030 1027 1031 debuglocal( 4,"num_eas = %d\n", num_eas);1028 debuglocal(pRes, 4,"num_eas = %d\n", num_eas); 1032 1029 1033 1030 // we will count that os/2 max EA size for file is 64kb … … 1036 1033 { 1037 1034 int namelen = strlen(ea_list[i].name); 1038 debuglocal( 4, "%d Got EA <%s> with namelen %d, size %d. Gross %d. Buf %d\n", i, ea_list[i].name, namelen, ea_list[i].value.length, gotsize, size);1035 debuglocal(pRes, 4, "%d Got EA <%s> with namelen %d, size %d. Gross %d. Buf %d\n", i, ea_list[i].name, namelen, ea_list[i].value.length, gotsize, size); 1039 1036 if (namelen > 0xFF || ea_list[i].value.length > 0xFFFF) 1040 1037 { 1041 debuglocal( 4, "Skip EA <%s> with namelen %d, size %d\n", ea_list[i].name, namelen, ea_list[i].value.length);1038 debuglocal(pRes, 4, "Skip EA <%s> with namelen %d, size %d\n", ea_list[i].name, namelen, ea_list[i].value.length); 1042 1039 continue; 1043 1040 } … … 1056 1053 } 1057 1054 pfealist->cbList = gotsize; 1058 debuglocal( 4,"ret size = %d\n", gotsize);1055 debuglocal(pRes, 4,"ret size = %d\n", gotsize); 1059 1056 1060 1057 talloc_destroy(mem_ctx); … … 1065 1062 * lists EA of a path 1066 1063 */ 1067 int _System smbwrp_listea( cli_state * cli, char *fname, void * buffer, unsigned long size)1064 int _System smbwrp_listea(Resource *pRes, cli_state * cli, char *fname, void * buffer, unsigned long size) 1068 1065 { 1069 1066 if (!cli || !fname || !buffer) 1070 1067 return maperror(EINVAL); 1071 1068 1072 debuglocal( 4,"EALIst for <%s>\n", fname);1073 return unilistea( cli, fname, buffer, size);1069 debuglocal(pRes, 4,"EALIst for <%s>\n", fname); 1070 return unilistea(pRes, cli, fname, buffer, size); 1074 1071 } 1075 1072 … … 1077 1074 * lists EA of a file 1078 1075 */ 1079 int _System smbwrp_flistea( cli_state * cli, smbwrp_file *file, void * buffer, unsigned long size)1076 int _System smbwrp_flistea(Resource *pRes, cli_state * cli, smbwrp_file *file, void * buffer, unsigned long size) 1080 1077 { 1081 1078 if (!cli || !file || !buffer) 1082 1079 return maperror(EINVAL); 1083 1080 1084 debuglocal( 4,"FEALIst for <%s>\n", file->fname);1085 return unilistea( cli, file->fname, buffer, size);1081 debuglocal(pRes, 4,"FEALIst for <%s>\n", file->fname); 1082 return unilistea(pRes, cli, file->fname, buffer, size); 1086 1083 } 1087 1084 … … 1089 1086 * Check the space on a device. 1090 1087 */ 1091 int _System smbwrp_dskattr( cli_state * cli, FSALLOCATE *pfsa)1088 int _System smbwrp_dskattr(Resource *pRes, cli_state * cli, FSALLOCATE *pfsa) 1092 1089 { 1093 1090 int total, bsize, avail; … … 1098 1095 if (!NT_STATUS_IS_OK(cli_dskattr(cli, &bsize, &total, &avail))) 1099 1096 { 1100 debuglocal( 4,"Error in dskattr: %s\n",cli_errstr(cli));1101 return os2cli_errno(cli); 1102 } 1103 1104 debuglocal( 4,"\n\t\t%d blocks of size %d. %d blocks available\n",1097 debuglocal(pRes, 4,"Error in dskattr: %s\n",cli_errstr(cli)); 1098 return os2cli_errno(cli); 1099 } 1100 1101 debuglocal(pRes, 4,"\n\t\t%d blocks of size %d. %d blocks available\n", 1105 1102 total, bsize, avail); 1106 1103 -
trunk/client/src/smbwrp.h
r959 r960 142 142 int cachedepth; 143 143 int loglevel; 144 char logfile[_MAX_PATH +1]; 145 FILE *logfileFH; 146 char smb_logfile[_MAX_PATH +1]; 147 int ifL; 148 int firstLogLine; 149 int smb_initialised; 144 150 struct DirectoryCache *pdc; 145 151 } Resource; … … 173 179 174 180 int _System smbwrp_getclisize(void); 175 int _System smbwrp_init( void);181 int _System smbwrp_init(Resource *pRes); 176 182 int _System smbwrp_connect(Resource * pRes, cli_state **); 177 183 void _System smbwrp_disconnect(Resource * pRes, cli_state *); 178 int _System smbwrp_open( cli_state * cli, smbwrp_file * file);179 int _System smbwrp_read( cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result);180 int _System smbwrp_write( cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result);181 int _System smbwrp_lseek( cli_state * cli, smbwrp_file * file, int whence, long long offset);182 int _System smbwrp_close( cli_state * cli, smbwrp_file * file);183 int _System smbwrp_setattr( cli_state * cli, smbwrp_fileinfo *finfo);184 int _System smbwrp_getattr( smbwrp_server *srv, cli_state * cli, smbwrp_fileinfo *finfo);185 int _System smbwrp_fgetattr( cli_state * cli, smbwrp_file *file, smbwrp_fileinfo *finfo);186 int _System smbwrp_filelist( smbwrp_server *srv, cli_state * cli, filelist_state * state);187 int _System smbwrp_rename( cli_state * cli, char *oldname, char *newname);188 int _System smbwrp_chdir( smbwrp_server *srv, cli_state * cli, char *fname);189 int _System smbwrp_mkdir( cli_state * cli, char *fname);190 int _System smbwrp_rmdir( cli_state * cli, char *fname);191 int _System smbwrp_unlink( cli_state * cli, const char *fname);192 int _System smbwrp_setfilesize( cli_state * cli, smbwrp_file * file, long long newsize);193 int _System smbwrp_setea( cli_state * cli, char *fname, char * name, unsigned char * value, int size);194 int _System smbwrp_fsetea( cli_state * cli, smbwrp_file *file, char * name, unsigned char * value, int size);195 int _System smbwrp_listea( cli_state * cli, char *fname, void * buffer, unsigned long size);196 int _System smbwrp_flistea( cli_state * cli, smbwrp_file *file, void * buffer, unsigned long size);197 int _System smbwrp_dskattr( cli_state * cli, FSALLOCATE *pfsa);184 int _System smbwrp_open(Resource *pRes, cli_state * cli, smbwrp_file * file); 185 int _System smbwrp_read(Resource *pRes, cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result); 186 int _System smbwrp_write(Resource *pRes, cli_state * cli, smbwrp_file * file, void *buf, unsigned long count, unsigned long * result); 187 int _System smbwrp_lseek(Resource *pRes, cli_state * cli, smbwrp_file * file, int whence, long long offset); 188 int _System smbwrp_close(Resource *pRes, cli_state * cli, smbwrp_file * file); 189 int _System smbwrp_setattr(Resource *pRes, cli_state * cli, smbwrp_fileinfo *finfo); 190 int _System smbwrp_getattr(Resource *pRes, smbwrp_server *srv, cli_state * cli, smbwrp_fileinfo *finfo); 191 int _System smbwrp_fgetattr(Resource *pRes, cli_state * cli, smbwrp_file *file, smbwrp_fileinfo *finfo); 192 int _System smbwrp_filelist(Resource *pRes, smbwrp_server *srv, cli_state * cli, filelist_state * state); 193 int _System smbwrp_rename(Resource *pRes, cli_state * cli, char *oldname, char *newname); 194 int _System smbwrp_chdir(Resource *pRes, smbwrp_server *srv, cli_state * cli, char *fname); 195 int _System smbwrp_mkdir(Resource *pRes, cli_state * cli, char *fname); 196 int _System smbwrp_rmdir(Resource *pRes, cli_state * cli, char *fname); 197 int _System smbwrp_unlink(Resource *pRes, cli_state * cli, const char *fname); 198 int _System smbwrp_setfilesize(Resource *pRes, cli_state * cli, smbwrp_file * file, long long newsize); 199 int _System smbwrp_setea(Resource *pRes, cli_state * cli, char *fname, char * name, unsigned char * value, int size); 200 int _System smbwrp_fsetea(Resource *pRes, cli_state * cli, smbwrp_file *file, char * name, unsigned char * value, int size); 201 int _System smbwrp_listea(Resource *pRes, cli_state * cli, char *fname, void * buffer, unsigned long size); 202 int _System smbwrp_flistea(Resource *pRes, cli_state * cli, smbwrp_file *file, void * buffer, unsigned long size); 203 int _System smbwrp_dskattr(Resource *pRes, cli_state * cli, FSALLOCATE *pfsa); 198 204 199 205 /* Directory cache helpers. */ 200 int dircache_create( struct DirectoryCache **ppdc, unsigned long ulExpirationTime, int cMaxEntries);201 void dircache_delete( struct DirectoryCache *pdc);206 int dircache_create(Resource *pRes); 207 void dircache_delete(Resource *pRes); 202 208 203 209 typedef void FNADDDIRENTRY(const char*, smbwrp_fileinfo *, const char *, void *); … … 213 219 void *dircache_write_begin(filelist_state *state, 214 220 int cFiles); 215 void dircache_write_entry( void *dircachectx, const smbwrp_fileinfo *finfo);216 void dircache_write_end( void *dircachectx);221 void dircache_write_entry(Resource *pRes, void *dircachectx, const smbwrp_fileinfo *finfo); 222 void dircache_write_end(Resource *pRes, void *dircachectx); 217 223 218 224 void dircache_invalidate(const char *path, 219 struct DirectoryCache *pdc,225 Resource *pRes, 220 226 int fParent); 221 227 222 int dircache_find_path( struct DirectoryCache *pdc,228 int dircache_find_path(Resource *pRes, 223 229 const char *path, 224 230 smbwrp_fileinfo *finfo, … … 226 232 227 233 /* Prototype the debug log helper. */ 228 void debuglocal( int level, const char * fmt, ...);234 void debuglocal(Resource *pRes, int level, const char * fmt, ...); 229 235 230 236 void smbwrp_initthread(void);
Note:
See TracChangeset
for help on using the changeset viewer.