[Fwd: Patch To winbindd_users to set template group as seen with getent passwd]

Gregory Hinton Nietsky gregory at networksentry.co.za
Fri Sep 12 17:46:19 GMT 2003

here is a small patch to set the primary group when the users are 
enumerated im not sure if all will want this
behaviour but it makes my life easier all users will be put into one 
group ie users this emulates the "old" way of adding unix users
and allows for simpler management ....

i have also changed the way template dir works in that all my users are 
now /var/home/user[0]/user[1]/user to allow for directory hashing this 
is set when hash2 is passed as a param to "template homedir"

doing things this way i run a server with local unix users [not domain 
users] and domain users on the same server with little differance 
between them
except for been granted certain privaleges that are stored ith the unix 
users ldap accounts this can be fixed in time ...

--- ../samba-3.0.0rc3/source/nsswitch/winbindd_user.c   Fri Sep 12 
17:59:47 2003
+++ nsswitch/winbindd_user.c    Fri Sep 12 18:03:21 2003
@@ -38,6 +38,7 @@
        fstring output_username;
        pstring homedir;
        fstring sid_string;
+       struct group *unix_group;

        if (!pw || !dom_name || !user_name)
                return False;
@@ -83,6 +84,10 @@

        safe_strcpy(pw->pw_shell, lp_template_shell(),
                    sizeof(pw->pw_shell) - 1);
+       unix_group=getgrnam(lp_template_primary_group());
+       if (unix_group != NULL)
+               pw->pw_gid=unix_group->gr_gid;

        /* Password - set to "x" as we can't generate anything useful here.
           Authentication can be done using the pam_winbind module. */

This message has been scanned for viruses and
dangerous content by Network Sentry, and is
believed to be clean.

More information about the samba-technical mailing list