Changeset 411 for branches/samba-3.3.x/source/libsmb
- Timestamp:
- Mar 1, 2010, 3:05:48 PM (15 years ago)
- Location:
- branches/samba-3.3.x/source/libsmb
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.3.x/source/libsmb/clirap.c
r206 r411 271 271 SIVAL(p,0,func); /* api number */ 272 272 p += 2; 273 /* Next time through we need to use the continue api */ 274 func = RAP_NetServerEnum3; 275 276 if (last_entry) { 277 strlcpy(p,"WrLehDOz", sizeof(param)-PTR_DIFF(p,param)); 273 274 if (func == RAP_NetServerEnum3) { 275 strlcpy(p,"WrLehDzz", sizeof(param)-PTR_DIFF(p,param)); 278 276 } else { 279 277 strlcpy(p,"WrLehDz", sizeof(param)-PTR_DIFF(p,param)); … … 294 292 */ 295 293 len = push_ascii(p, 296 last_entry ? last_entry :workgroup,294 workgroup, 297 295 sizeof(param) - PTR_DIFF(p,param) - 1, 298 296 STR_TERMINATE|STR_UPPER); … … 303 301 } 304 302 p += len; 303 304 if (func == RAP_NetServerEnum3) { 305 len = push_ascii(p, 306 last_entry ? last_entry : "", 307 sizeof(param) - PTR_DIFF(p,param) - 1, 308 STR_TERMINATE); 309 310 if (len == (size_t)-1) { 311 SAFE_FREE(last_entry); 312 return false; 313 } 314 p += len; 315 } 316 317 /* Next time through we need to use the continue api */ 318 func = RAP_NetServerEnum3; 305 319 306 320 if (!cli_api(cli, … … 365 379 char *s1, *s2; 366 380 TALLOC_CTX *frame = talloc_stackframe(); 381 uint32_t entry_stype; 367 382 368 383 if (p + 26 > rdata_end) { … … 375 390 cmnt = comment_offset?(rdata+comment_offset):""; 376 391 377 if (comment_offset < 0 || comment_offset > (int)rdrcnt) {392 if (comment_offset < 0 || comment_offset >= (int)rdrcnt) { 378 393 TALLOC_FREE(frame); 379 394 continue; … … 388 403 } 389 404 390 stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;405 entry_stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY; 391 406 392 407 pull_string_talloc(frame,rdata,0, … … 400 415 } 401 416 402 fn(s1, stype, s2, state);417 fn(s1, entry_stype, s2, state); 403 418 TALLOC_FREE(frame); 404 419 } -
branches/samba-3.3.x/source/libsmb/libsmb_context.c
r342 r411 193 193 194 194 /* Things we have to clean up */ 195 free(smbc_getWorkgroup(context));196 195 smbc_setWorkgroup(context, NULL); 197 198 free(smbc_getNetbiosName(context));199 196 smbc_setNetbiosName(context, NULL); 200 201 free(smbc_getUser(context));202 197 smbc_setUser(context, NULL); 203 198 … … 424 419 { 425 420 int pid; 426 char *user = NULL;427 421 char *home = NULL; 428 422 … … 533 527 * FIXME: Is this the best way to get the user info? 534 528 */ 535 529 char *user = getenv("USER"); 536 530 /* walk around as "guest" if no username can be found */ 537 531 if (!user) { … … 547 541 548 542 smbc_setUser(context, user); 543 SAFE_FREE(user); 544 545 if (!smbc_getUser(context)) { 546 errno = ENOMEM; 547 return NULL; 548 } 549 549 } 550 550 … … 579 579 580 580 smbc_setNetbiosName(context, netbios_name); 581 SAFE_FREE(netbios_name); 582 583 if (!smbc_getNetbiosName(context)) { 584 errno = ENOMEM; 585 return NULL; 586 } 581 587 } 582 588 … … 600 606 601 607 smbc_setWorkgroup(context, workgroup); 608 SAFE_FREE(workgroup); 609 610 if (!smbc_getWorkgroup(context)) { 611 errno = ENOMEM; 612 return NULL; 613 } 602 614 } 603 615 -
branches/samba-3.3.x/source/libsmb/libsmb_dir.c
r370 r411 304 304 305 305 /* For each returned entry... */ 306 for (i = 0; i < total_entries; i++) {306 for (i = 0; i < info_ctr.ctr.ctr1->count; i++) { 307 307 308 308 /* pull out the share name */ -
branches/samba-3.3.x/source/libsmb/libsmb_path.c
r221 r411 309 309 return -1; 310 310 } 311 *pp_server[wl] = '\0';311 (*pp_server)[wl] = '\0'; 312 312 return 0; 313 313 } -
branches/samba-3.3.x/source/libsmb/libsmb_setget.c
r221 r411 40 40 smbc_setNetbiosName(SMBCCTX *c, char * netbios_name) 41 41 { 42 c->netbios_name = netbios_name; 42 SAFE_FREE(c->netbios_name); 43 if (netbios_name) { 44 c->netbios_name = SMB_STRDUP(netbios_name); 45 } 43 46 } 44 47 … … 54 57 smbc_setWorkgroup(SMBCCTX *c, char * workgroup) 55 58 { 56 c->workgroup = workgroup; 59 SAFE_FREE(c->workgroup); 60 if (workgroup) { 61 c->workgroup = SMB_STRDUP(workgroup); 62 } 57 63 } 58 64 … … 68 74 smbc_setUser(SMBCCTX *c, char * user) 69 75 { 70 c->user = user; 76 SAFE_FREE(c->user); 77 if (user) { 78 c->user = SMB_STRDUP(user); 79 } 71 80 } 72 81
Note:
See TracChangeset
for help on using the changeset viewer.