Changeset 627 for trunk/client/src/smbwrp.c
- Timestamp:
- Aug 24, 2011, 7:31:18 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/src/smbwrp.c
r567 r627 147 147 const char * smbwrp_getVersion() 148 148 { 149 return SAMBA_VERSION_STRING;149 return samba_version_string(); 150 150 } 151 151 … … 566 566 dev_type = "A:"; 567 567 568 if (! cli_send_tconX(c, share, dev_type,569 srv->password, strlen(srv->password)+1)) {568 if (!NT_STATUS_IS_OK(cli_tcon_andx(c, share, dev_type, 569 srv->password, strlen(srv->password)+1))) { 570 570 cli_shutdown(c); 571 571 // if loginerror is != 0 means normal login failed, but anonymous login worked … … 603 603 int _System smbwrp_open(cli_state * cli, smbwrp_file * file) 604 604 { 605 int fd = -1;605 uint16_t fd = 0; 606 606 607 607 if (!cli || !file || !*file->fname) … … 615 615 616 616 debuglocal(4,"cli_open(%s) attr %08x mode %02x denymode %02x\n", file->fname, file->openattr, file->openmode, file->denymode); 617 file->fd = cli_open(cli, file->fname, file->openmode, file->denymode); 618 if (file->fd == -1) 617 if (!NT_STATUS_IS_OK(cli_open(cli, file->fname, file->openmode, file->denymode, &fd))) 619 618 { 620 619 return os2cli_errno(cli); 621 620 } 621 file->fd = fd; 622 622 if (file->openmode & (O_WRONLY | O_RDWR | O_TRUNC | O_CREAT)) 623 623 { … … 780 780 return os2cli_errno(cli); 781 781 } 782 uint16_t fd = 0; 782 783 file->fd = -1; 783 784 file->offset = 0; … … 785 786 file->openmode |= O_TRUNC; 786 787 debuglocal(4,"cli_setnewfileszie : cli_open(%s) attr %08x mode %02x denymode %02x\n", file->fname, file->openattr, file->openmode, file->denymode); 787 file->fd = cli_open(cli, file->fname, file->openmode, file->denymode); 788 if (file->fd == -1) 788 if (!NT_STATUS_IS_OK(cli_open(cli, file->fname, file->openmode, file->denymode, &fd))) 789 789 { 790 790 return os2cli_errno(cli); 791 791 } 792 file->fd = fd; 792 793 } 793 794 return 0; … … 859 860 } else 860 861 #endif 861 if (! cli_unlink(cli, fname))862 if (!NT_STATUS_IS_OK(cli_unlink(cli, fname, aSYSTEM | aHIDDEN))) 862 863 { 863 864 return os2cli_errno(cli); … … 899 900 NULL, NULL) && 900 901 !cli_getattrE(cli, file->fd, 901 NULL, (SMB_BIG_UINT *)&size, NULL, NULL, NULL))902 NULL, &size, NULL, NULL, NULL)) 902 903 { 903 904 return os2cli_errno(cli); … … 1007 1008 { 1008 1009 if (!cli_getattrE(cli, file->fd, 1009 (unsigned short *)&finfo->attr, ( SMB_BIG_UINT *)(&finfo->size), (time_t *)&finfo->ctime, (time_t *)&finfo->atime, (time_t *)&finfo->mtime))1010 (unsigned short *)&finfo->attr, (&finfo->size), (time_t *)&finfo->ctime, (time_t *)&finfo->atime, (time_t *)&finfo->mtime)) 1010 1011 { 1011 1012 return os2cli_errno(cli); … … 1128 1129 1129 1130 switch (level) { 1130 case 1: /* OS/2 understands this */1131 case SMB_FIND_INFO_STANDARD: /* OS/2 understands this */ 1131 1132 /* these dates are converted to GMT by 1132 1133 make_unix_date */ … … 1161 1162 between win2000 and win9x for this call 1162 1163 (tridge) */ 1163 ret = clistr_pull_talloc(ctx, cli , &fname, p,1164 ret = clistr_pull_talloc(ctx, cli->inbuf, &fname, p, 1164 1165 len+2, 1165 1166 STR_TERMINATE); … … 1172 1173 return PTR_DIFF(p, base); 1173 1174 1174 case 2: /* this is what OS/2 uses mostly */1175 case SMB_FIND_EA_SIZE: /* this is what OS/2 uses mostly */ 1175 1176 /* these dates are converted to GMT by 1176 1177 make_unix_date */ … … 1190 1191 return pdata_end - base; 1191 1192 } 1192 ret = clistr_pull_talloc(ctx, cli , &fname, p,1193 ret = clistr_pull_talloc(ctx, cli->inbuf, &fname, p, 1193 1194 len, 1194 1195 STR_NOALIGN); … … 1200 1201 return PTR_DIFF(p, base) + 1; 1201 1202 1202 case 260: /* NT uses this, but also accepts 2 */1203 case SMB_FIND_FILE_BOTH_DIRECTORY_INFO: /* NT uses this, but also accepts 2 */ 1203 1204 { 1204 1205 size_t namelen, slen; … … 1253 1254 return pdata_end - base; 1254 1255 } 1255 ret = clistr_pull_talloc(ctx, cli , &fname, p,1256 ret = clistr_pull_talloc(ctx, cli->inbuf, &fname, p, 1256 1257 namelen, 0); 1257 1258 if (ret == (size_t)-1) { … … 1309 1310 uint16 setup; 1310 1311 char *param; 1311 const char *mnt;1312 1312 uint32 resume_key = 0; 1313 1313 TALLOC_CTX *frame = talloc_stackframe(); 1314 1314 DATA_BLOB last_name_raw = data_blob(NULL, 0); 1315 1315 1316 /* NT uses 260, OS/2 uses 2. Both accept 1. */ 1317 info_level = (cli->capabilities&CAP_NT_SMBS)?260:2; 1316 /* NT uses SMB_FIND_FILE_BOTH_DIRECTORY_INFO, 1317 OS/2 uses SMB_FIND_EA_SIZE. Both accept SMB_FIND_INFO_STANDARD. */ 1318 info_level = (cli->capabilities&CAP_NT_SMBS)? 1319 SMB_FIND_FILE_BOTH_DIRECTORY_INFO : SMB_FIND_EA_SIZE; 1318 1320 1319 1321 debuglocal(4,"list_files level %d. mask <%s>\n", info_level, Mask); … … 1372 1374 p += last_name_raw.length; 1373 1375 } else { 1374 p += clistr_push(cli, param+12, mask, nlen, STR_TERMINATE); 1376 p += clistr_push(cli, param+12, mask, 1377 nlen, STR_TERMINATE); 1375 1378 } 1376 1379 } … … 1433 1436 if (cli_is_error(cli) || !rdata || !rparam) 1434 1437 { 1435 if (First && info_level == 2)1438 if (First && info_level == SMB_FIND_EA_SIZE) 1436 1439 { 1437 1440 // we have tried query ea size, but now will try without ea size 1438 info_level = 1;1441 info_level = SMB_FIND_INFO_STANDARD; 1439 1442 debuglocal(4,"list_files fallback to level %d\n", info_level); 1440 1443 continue; … … 1474 1477 /* we might need the lastname for continuations */ 1475 1478 for (p2=p,i=0;i<ff_searchcount && p2 < rdata_end;i++) { 1476 if ((info_level == 260) && (i == ff_searchcount-1)) { 1479 if ((info_level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) && 1480 (i == ff_searchcount-1)) { 1477 1481 /* Last entry - fixup the last offset length. */ 1478 1482 SIVAL(p2,0,PTR_DIFF((rdata + data_len),p2)); … … 1497 1501 1498 1502 SAFE_FREE(mask); 1499 if (ff_searchcount > 0 ) {1503 if (ff_searchcount > 0 && ff_eos == 0 && finfo.fname) { 1500 1504 mask = SMB_STRDUP(finfo.fname); 1501 1505 } else { … … 1536 1540 } 1537 1541 1538 mnt = cli_cm_get_mntpoint( cli );1539 1540 1542 /* see if the server disconnected or the connection otherwise failed */ 1541 1543 if (cli_is_error(cli)) { … … 1555 1557 break; 1556 1558 } 1557 fn( mnt,&finfo, Mask, state );1559 fn(cli->dfs_mountpoint,&finfo, Mask, state ); 1558 1560 1559 1561 /* Also add the entry to the cache. */
Note:
See TracChangeset
for help on using the changeset viewer.