Ignore:
Timestamp:
Mar 1, 2010, 3:05:48 PM (15 years ago)
Author:
Herwig Bauernfeind
Message:

Update Samba 3.3.x to 3.3.11

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  
    271271                SIVAL(p,0,func); /* api number */
    272272                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));
    278276                } else {
    279277                        strlcpy(p,"WrLehDz", sizeof(param)-PTR_DIFF(p,param));
     
    294292                 */
    295293                len = push_ascii(p,
    296                                 last_entry ? last_entry : workgroup,
     294                                workgroup,
    297295                                sizeof(param) - PTR_DIFF(p,param) - 1,
    298296                                STR_TERMINATE|STR_UPPER);
     
    303301                }
    304302                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;
    305319
    306320                if (!cli_api(cli,
     
    365379                                char *s1, *s2;
    366380                                TALLOC_CTX *frame = talloc_stackframe();
     381                                uint32_t entry_stype;
    367382
    368383                                if (p + 26 > rdata_end) {
     
    375390                                cmnt = comment_offset?(rdata+comment_offset):"";
    376391
    377                                 if (comment_offset < 0 || comment_offset > (int)rdrcnt) {
     392                                if (comment_offset < 0 || comment_offset >= (int)rdrcnt) {
    378393                                        TALLOC_FREE(frame);
    379394                                        continue;
     
    388403                                }
    389404
    390                                 stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
     405                                entry_stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
    391406
    392407                                pull_string_talloc(frame,rdata,0,
     
    400415                                }
    401416
    402                                 fn(s1, stype, s2, state);
     417                                fn(s1, entry_stype, s2, state);
    403418                                TALLOC_FREE(frame);
    404419                        }
  • branches/samba-3.3.x/source/libsmb/libsmb_context.c

    r342 r411  
    193193       
    194194        /* Things we have to clean up */
    195         free(smbc_getWorkgroup(context));
    196195        smbc_setWorkgroup(context, NULL);
    197 
    198         free(smbc_getNetbiosName(context));
    199196        smbc_setNetbiosName(context, NULL);
    200 
    201         free(smbc_getUser(context));
    202197        smbc_setUser(context, NULL);
    203198       
     
    424419{
    425420        int pid;
    426         char *user = NULL;
    427421        char *home = NULL;
    428422       
     
    533527                 * FIXME: Is this the best way to get the user info?
    534528                 */
    535                 user = getenv("USER");
     529                char *user = getenv("USER");
    536530                /* walk around as "guest" if no username can be found */
    537531                if (!user) {
     
    547541
    548542                smbc_setUser(context, user);
     543                SAFE_FREE(user);
     544
     545                if (!smbc_getUser(context)) {
     546                        errno = ENOMEM;
     547                        return NULL;
     548                }
    549549        }
    550550       
     
    579579               
    580580                smbc_setNetbiosName(context, netbios_name);
     581                SAFE_FREE(netbios_name);
     582
     583                if (!smbc_getNetbiosName(context)) {
     584                        errno = ENOMEM;
     585                        return NULL;
     586                }
    581587        }
    582588       
     
    600606
    601607                smbc_setWorkgroup(context, workgroup);
     608                SAFE_FREE(workgroup);
     609
     610                if (!smbc_getWorkgroup(context)) {
     611                        errno = ENOMEM;
     612                        return NULL;
     613                }
    602614        }
    603615       
  • branches/samba-3.3.x/source/libsmb/libsmb_dir.c

    r370 r411  
    304304
    305305        /* For each returned entry... */
    306         for (i = 0; i < total_entries; i++) {
     306        for (i = 0; i < info_ctr.ctr.ctr1->count; i++) {
    307307
    308308                /* pull out the share name */
  • branches/samba-3.3.x/source/libsmb/libsmb_path.c

    r221 r411  
    309309                        return -1;
    310310                }
    311                 *pp_server[wl] = '\0';
     311                (*pp_server)[wl] = '\0';
    312312                return 0;
    313313        }
  • branches/samba-3.3.x/source/libsmb/libsmb_setget.c

    r221 r411  
    4040smbc_setNetbiosName(SMBCCTX *c, char * netbios_name)
    4141{
    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        }
    4346}
    4447
     
    5457smbc_setWorkgroup(SMBCCTX *c, char * workgroup)
    5558{
    56         c->workgroup = workgroup;
     59        SAFE_FREE(c->workgroup);
     60        if (workgroup) {
     61                c->workgroup = SMB_STRDUP(workgroup);
     62        }
    5763}
    5864
     
    6874smbc_setUser(SMBCCTX *c, char * user)
    6975{
    70         c->user = user;
     76        SAFE_FREE(c->user);
     77        if (user) {
     78                c->user = SMB_STRDUP(user);
     79        }
    7180}
    7281
Note: See TracChangeset for help on using the changeset viewer.