Changeset 960 for trunk/client/src/ndpsmb.c
- Timestamp:
- Aug 16, 2016, 5:41:49 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note:
See TracChangeset
for help on using the changeset viewer.