~ubuntu-branches/ubuntu/maverick/samba/maverick-security

« back to all changes in this revision

Viewing changes to source3/libsmb/libsmb_context.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-01-29 06:16:15 UTC
  • mfrom: (0.27.9 upstream) (0.34.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100129061615-37hs6xqpsdhjq3ld
Tags: 2:3.4.5~dfsg-1ubuntu1
* Merge from debian testing.  Remaining changes:
  + debian/patches/VERSION.patch:
    - set SAMBA_VERSION_SUFFIX to Ubuntu.
  + debian/smb.conf:
    - Add "(Samba, Ubuntu)" to server string.
    - Comment out the default [homes] share, and add a comment about "valid users = %s"
      to show users how to restrict access to \\server\username to only username.
    - Set 'usershare allow guests', so that usershare admins are allowed to create
      public shares in additon to authenticated ones.
    - add map to guest = Bad user, maps bad username to gues access.
  + debian/samba-common.conf:
    - Do not change priority to high if dhclient3 is installed.
    - Use priority medium instead of high for the workgroup question.
  + debian/mksambapasswd.awk:
    - Do not add user with UID less than 1000 to smbpasswd.
  + debian/control: 
    - Make libswbclient0 replace/conflict with hardy's likewise-open.
    - Don't build against ctdb, since its not in main yet.
  + debian/rules:
    - Enable "native" PIE hardening.
    - Add BIND_NOW to maximize benefit of RELRO hardening.
  + Add ufw integration:
    - Created debian/samba.ufw.profile.
    - debian/rules, debian/samba.dirs, debian/samba.files: install
  + Add apoort hook:
    - Created debian/source_samba.py.
    - debian/rules, debian/samba.dirs, debian/samba-common-bin.files: install
  + debian/rules, debian/samba.if-up: allow "NetworkManager" as a recognized address
    family... it's obviously /not/ an address family, but it's what gets
    sent when using NM, so we'll cope for now.  (LP: #462169). Taken from karmic-proposed.
  + debian/control: Recommend keyutils for smbfs (LP: #493565)
  + Dropped patches:
    - debian/patches/security-CVE-2009-3297.patch: No longer needed
    - debian/patches/fix-too-many-open-files.patch: No longer needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
        }
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
        
204
199
        DEBUG(3, ("Context %p successfully freed\n", context));
426
421
smbc_init_context(SMBCCTX *context)
427
422
{
428
423
        int pid;
429
 
        char *user = NULL;
430
424
        char *home = NULL;
431
425
        
432
426
        if (!context) {
535
529
                /*
536
530
                 * FIXME: Is this the best way to get the user info?
537
531
                 */
538
 
                user = getenv("USER");
 
532
                char *user = getenv("USER");
539
533
                /* walk around as "guest" if no username can be found */
540
534
                if (!user) {
541
535
                        user = SMB_STRDUP("guest");
549
543
                }
550
544
 
551
545
                smbc_setUser(context, user);
 
546
                SAFE_FREE(user);
 
547
 
 
548
                if (!smbc_getUser(context)) {
 
549
                        errno = ENOMEM;
 
550
                        return NULL;
 
551
                }
552
552
        }
553
553
        
554
554
        if (!smbc_getNetbiosName(context)) {
581
581
                }
582
582
                
583
583
                smbc_setNetbiosName(context, netbios_name);
 
584
                SAFE_FREE(netbios_name);
 
585
 
 
586
                if (!smbc_getNetbiosName(context)) {
 
587
                        errno = ENOMEM;
 
588
                        return NULL;
 
589
                }
584
590
        }
585
591
        
586
592
        DEBUG(1, ("Using netbios name %s.\n", smbc_getNetbiosName(context)));
602
608
                }
603
609
 
604
610
                smbc_setWorkgroup(context, workgroup);
 
611
                SAFE_FREE(workgroup);
 
612
 
 
613
                if (!smbc_getWorkgroup(context)) {
 
614
                        errno = ENOMEM;
 
615
                        return NULL;
 
616
                }
605
617
        }
606
618
        
607
619
        DEBUG(1, ("Using workgroup %s.\n", smbc_getWorkgroup(context)));