The branch, master has been updated
       via  471ed70... s3:smbd map_username() doesn't need sconn anymore
       via  6a25668... s3:smbd user_ok doesn't need sconn anymore
       via  94bf9ce... s3:smbd user_in_list() doesn't need sconn anymore
       via  7747dd8... s3:smbd user_in_network() doesn't need sconn anymore
       via  b32b59d... s3:smbd make yp cache local.
      from  1da4153... buildtools/wafsamba: use build group 'final' for the 
creation of manpages

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 471ed70c497f4eeaca27594d609f41f2b2c689cd
Author: Simo Sorce <[email protected]>
Date:   Mon May 31 10:52:06 2010 -0400

    s3:smbd map_username() doesn't need sconn anymore
    
    Signed-off-by: Andreas Schneider <[email protected]>

commit 6a25668e55929a8111ac0fc5e34b5a83ae936349
Author: Simo Sorce <[email protected]>
Date:   Mon May 31 10:47:01 2010 -0400

    s3:smbd user_ok doesn't need sconn anymore
    
    Signed-off-by: Andreas Schneider <[email protected]>

commit 94bf9ce48a0ef8b77f22f3be6244881ca1a41e49
Author: Simo Sorce <[email protected]>
Date:   Mon May 31 10:45:24 2010 -0400

    s3:smbd user_in_list() doesn't need sconn anymore
    
    Signed-off-by: Andreas Schneider <[email protected]>

commit 7747dd82f79bc503efe6a2d3139413afb8dda864
Author: Simo Sorce <[email protected]>
Date:   Mon May 31 10:43:19 2010 -0400

    s3:smbd user_in_network() doesn't need sconn anymore
    
    Signed-off-by: Andreas Schneider <[email protected]>

commit b32b59d47f8ec597be9d215e5e260e5d1411d3a4
Author: Simo Sorce <[email protected]>
Date:   Mon May 31 10:36:02 2010 -0400

    s3:smbd make yp cache local.
    
    The my_yp_domain variable is just a static cache needed to avoid
    making over and over expensive and potentially blocking calls to
    yp_get_default_domain().
    Instead of keeping this onto the smbd_server_connection struct, just
    keep it local to the only function ever using this variable.
    
    This disentagle this function (and a number of calling functions)
    from having to pass around smbd_server_connection and thus having
    to link against smbd. It also removes a few ifdefs.
    
    Nothing changes from a global/local pov, as the smbd_server_connection
    variable passed around is also a global one.
    
    Signed-off-by: Andreas Schneider <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source3/auth/auth_util.c         |    6 +---
 source3/include/proto.h          |    8 ++---
 source3/rpc_server/srv_samr_nt.c |    9 ++----
 source3/smbd/globals.h           |    3 --
 source3/smbd/map_username.c      |    4 +-
 source3/smbd/password.c          |   55 ++++++++++++++++----------------------
 source3/smbd/process.c           |    3 --
 source3/smbd/service.c           |    5 +--
 source3/smbd/sesssetup.c         |    4 +-
 source3/smbd/share_access.c      |    2 +-
 source3/smbd/smb2_sesssetup.c    |    3 +-
 11 files changed, 39 insertions(+), 63 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 74d8873..3a63a3b 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -119,13 +119,12 @@ NTSTATUS make_user_info_map(struct auth_usersupplied_info 
**user_info,
                            DATA_BLOB *plaintext,
                            bool encrypted)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        const char *domain;
        NTSTATUS result;
        bool was_mapped;
        fstring internal_username;
        fstrcpy(internal_username, smb_name);
-       was_mapped = map_username(sconn, internal_username);
+       was_mapped = map_username(internal_username);
 
        DEBUG(5, ("Mapping user [%s]\\[%s] from workstation [%s]\n",
                 client_domain, smb_name, wksta_name));
@@ -972,7 +971,6 @@ static NTSTATUS check_account(TALLOC_CTX *mem_ctx, const 
char *domain,
                              uid_t *uid, gid_t *gid,
                              bool *username_was_mapped)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        fstring dom_user, lower_username;
        fstring real_username;
        struct passwd *passwd;
@@ -985,7 +983,7 @@ static NTSTATUS check_account(TALLOC_CTX *mem_ctx, const 
char *domain,
 
        /* Get the passwd struct.  Try to create the account if necessary. */
 
-       *username_was_mapped = map_username(sconn, dom_user);
+       *username_was_mapped = map_username(dom_user);
 
        passwd = smb_getpwnam( NULL, dom_user, real_username, True );
        if (!passwd) {
diff --git a/source3/include/proto.h b/source3/include/proto.h
index cae51e5..237772e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5689,7 +5689,7 @@ const struct mangle_fns *posix_mangle_init(void);
 
 /* The following definitions come from smbd/map_username.c  */
 
-bool map_username(struct smbd_server_connection *sconn, fstring user);
+bool map_username(fstring user);
 
 /* The following definitions come from smbd/message.c  */
 
@@ -5971,10 +5971,8 @@ void add_session_user(struct smbd_server_connection 
*sconn, const char *user);
 void add_session_workgroup(struct smbd_server_connection *sconn,
                           const char *workgroup);
 const char *get_session_workgroup(struct smbd_server_connection *sconn);
-bool user_in_netgroup(struct smbd_server_connection *sconn,
-                     const char *user, const char *ngname);
-bool user_in_list(struct smbd_server_connection *sconn,
-                 const char *user,const char **list);
+bool user_in_netgroup(const char *user, const char *ngname);
+bool user_in_list(const char *user,const char **list);
 bool authorise_login(struct smbd_server_connection *sconn,
                     int snum, fstring user, DATA_BLOB password,
                     bool *guest);
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index 5b8a79f..30c5c5e 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -1922,7 +1922,6 @@ NTSTATUS _samr_ChangePasswordUser(pipes_struct *p,
 NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p,
                                   struct samr_ChangePasswordUser2 *r)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        NTSTATUS status;
        fstring user_name;
        fstring wks;
@@ -1939,7 +1938,7 @@ NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p,
         * function.
         */
 
-       (void)map_username(sconn, user_name);
+       (void)map_username(user_name);
 
        /*
         * UNIX username case mangling not required, pass_oem_change
@@ -1969,7 +1968,6 @@ NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p,
 NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p,
                                      struct samr_OemChangePasswordUser2 *r)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        NTSTATUS status;
        fstring user_name;
        const char *wks = NULL;
@@ -1988,7 +1986,7 @@ NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p,
         * function.
         */
 
-       (void)map_username(sconn, user_name);
+       (void)map_username(user_name);
 
        /*
         * UNIX username case mangling not required, pass_oem_change
@@ -2022,7 +2020,6 @@ NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p,
 NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p,
                                   struct samr_ChangePasswordUser3 *r)
 {
-       struct smbd_server_connection *sconn = smbd_server_conn;
        NTSTATUS status;
        fstring user_name;
        const char *wks = NULL;
@@ -2045,7 +2042,7 @@ NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p,
         * function.
         */
 
-       (void)map_username(sconn, user_name);
+       (void)map_username(user_name);
 
        /*
         * UNIX username case mangling not required, pass_oem_change
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index cd45165..3666148 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -515,9 +515,6 @@ struct smbd_server_connection {
                        user_struct *validated_users;
                        uint16_t next_vuid;
                        int num_validated_vuids;
-#ifdef HAVE_NETGROUP
-                       char *my_yp_domain;
-#endif
                } sessions;
                struct {
                        connection_struct *Connections;
diff --git a/source3/smbd/map_username.c b/source3/smbd/map_username.c
index dc5d48e..9b24d8f 100644
--- a/source3/smbd/map_username.c
+++ b/source3/smbd/map_username.c
@@ -118,7 +118,7 @@ static void store_map_in_gencache(const char *from, const 
char *to)
        TALLOC_FREE(key);
 }
 
-bool map_username(struct smbd_server_connection *sconn, fstring user)
+bool map_username(fstring user)
 {
        XFILE *f;
        char *mapfile = lp_username_map();
@@ -239,7 +239,7 @@ bool map_username(struct smbd_server_connection *sconn, 
fstring user)
                }
 
                if (strchr_m(dosname,'*') ||
-                   user_in_list(sconn, user, (const char **)dosuserlist)) {
+                   user_in_list(user, (const char **)dosuserlist)) {
                        DEBUG(3,("Mapped user %s to %s\n",user,unixname));
                        mapped_user = True;
 
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 809a913..640e634 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -408,28 +408,25 @@ const char *get_session_workgroup(struct 
smbd_server_connection *sconn)
  try lower case.
 ****************************************************************************/
 
-bool user_in_netgroup(struct smbd_server_connection *sconn,
-                     const char *user, const char *ngname)
+bool user_in_netgroup(const char *user, const char *ngname)
 {
 #ifdef HAVE_NETGROUP
+       static char *my_yp_domain = NULL;
        fstring lowercase_user;
 
-       if (sconn->smb1.sessions.my_yp_domain == NULL) {
-               yp_get_default_domain(&sconn->smb1.sessions.my_yp_domain);
+       if (my_yp_domain == NULL) {
+               yp_get_default_domain(&my_yp_domain);
        }
 
-       if (sconn->smb1.sessions.my_yp_domain == NULL) {
+       if (my_yp_domain == NULL) {
                DEBUG(5,("Unable to get default yp domain, "
                        "let's try without specifying it\n"));
        }
 
        DEBUG(5,("looking for user %s of domain %s in netgroup %s\n",
-               user,
-               sconn->smb1.sessions.my_yp_domain?
-               sconn->smb1.sessions.my_yp_domain:"(ANY)",
-               ngname));
+               user, my_yp_domain?my_yp_domain:"(ANY)", ngname));
 
-       if (innetgr(ngname, NULL, user, sconn->smb1.sessions.my_yp_domain)) {
+       if (innetgr(ngname, NULL, user, my_yp_domain)) {
                DEBUG(5,("user_in_netgroup: Found\n"));
                return true;
        }
@@ -447,13 +444,9 @@ bool user_in_netgroup(struct smbd_server_connection *sconn,
        }
 
        DEBUG(5,("looking for user %s of domain %s in netgroup %s\n",
-               lowercase_user,
-               sconn->smb1.sessions.my_yp_domain?
-               sconn->smb1.sessions.my_yp_domain:"(ANY)",
-               ngname));
+               lowercase_user, my_yp_domain?my_yp_domain:"(ANY)", ngname));
 
-       if (innetgr(ngname, NULL, lowercase_user,
-                   sconn->smb1.sessions.my_yp_domain)) {
+       if (innetgr(ngname, NULL, lowercase_user, my_yp_domain)) {
                DEBUG(5,("user_in_netgroup: Found\n"));
                return true;
        }
@@ -466,8 +459,7 @@ bool user_in_netgroup(struct smbd_server_connection *sconn,
  and netgroup lists.
 ****************************************************************************/
 
-bool user_in_list(struct smbd_server_connection *sconn,
-                 const char *user,const char **list)
+bool user_in_list(const char *user,const char **list)
 {
        if (!list || !*list)
                return False;
@@ -495,7 +487,7 @@ bool user_in_list(struct smbd_server_connection *sconn,
                         * Old behaviour. Check netgroup list
                         * followed by UNIX list.
                         */
-                       if(user_in_netgroup(sconn, user, *list +1))
+                       if(user_in_netgroup(user, *list +1))
                                return True;
                        if(user_in_group(user, *list +1))
                                return True;
@@ -507,7 +499,7 @@ bool user_in_list(struct smbd_server_connection *sconn,
                                 */
                                if(user_in_group(user, *list +2))
                                        return True;
-                               if(user_in_netgroup(sconn, user, *list +2))
+                               if(user_in_netgroup(user, *list +2))
                                        return True;
 
                        } else {
@@ -526,7 +518,7 @@ bool user_in_list(struct smbd_server_connection *sconn,
                                /*
                                 * Search netgroup list followed by UNIX list.
                                 */
-                               if(user_in_netgroup(sconn, user, *list +2))
+                               if(user_in_netgroup(user, *list +2))
                                        return True;
                                if(user_in_group(user, *list +2))
                                        return True;
@@ -534,7 +526,7 @@ bool user_in_list(struct smbd_server_connection *sconn,
                                /*
                                 * Just search netgroup list.
                                 */
-                               if(user_in_netgroup(sconn, user, *list +1))
+                               if(user_in_netgroup(user, *list +1))
                                        return True;
                        }
                }
@@ -548,8 +540,7 @@ bool user_in_list(struct smbd_server_connection *sconn,
  Check if a username is valid.
 ****************************************************************************/
 
-static bool user_ok(struct smbd_server_connection *sconn,
-                   const char *user, int snum)
+static bool user_ok(const char *user, int snum)
 {
        bool ret;
 
@@ -565,7 +556,7 @@ static bool user_ok(struct smbd_server_connection *sconn,
                         * around to pass to str_list_sub_basic() */
 
                        if ( invalid && str_list_sub_basic(invalid, "", "") ) {
-                               ret = !user_in_list(sconn, user,
+                               ret = !user_in_list(user,
                                                    (const char **)invalid);
                        }
                }
@@ -582,7 +573,7 @@ static bool user_ok(struct smbd_server_connection *sconn,
                         * around to pass to str_list_sub_basic() */
 
                        if ( valid && str_list_sub_basic(valid, "", "") ) {
-                               ret = user_in_list(sconn, user,
+                               ret = user_in_list(user,
                                                   (const char **)valid);
                        }
                }
@@ -595,7 +586,7 @@ static bool user_ok(struct smbd_server_connection *sconn,
                if (user_list &&
                    str_list_substitute(user_list, "%S",
                                        lp_servicename(snum))) {
-                       ret = user_in_list(sconn, user,
+                       ret = user_in_list(user,
                                           (const char **)user_list);
                }
                TALLOC_FREE(user_list);
@@ -619,7 +610,7 @@ static char *validate_group(struct smbd_server_connection 
*sconn,
                setnetgrent(group);
                while (getnetgrent(&host, &user, &domain)) {
                        if (user) {
-                               if (user_ok(sconn, user, snum) &&
+                               if (user_ok(user, snum) &&
                                    password_ok(actx, enc,
                                                get_session_workgroup(sconn),
                                                user,password)) {
@@ -685,7 +676,7 @@ static char *validate_group(struct smbd_server_connection 
*sconn,
 
                        member = member_list;
                        while (*member) {
-                               if (user_ok(sconn, member,snum) &&
+                               if (user_ok(member,snum) &&
                                    password_ok(actx, enc,
                                                get_session_workgroup(sconn),
                                                member,password)) {
@@ -764,7 +755,7 @@ bool authorise_login(struct smbd_server_connection *sconn,
                     auser = strtok_r(NULL, LIST_SEP, &saveptr)) {
                        fstring user2;
                        fstrcpy(user2,auser);
-                       if (!user_ok(sconn,user2,snum))
+                       if (!user_ok(user2,snum))
                                continue;
 
                        if (password_ok(actx, enc,
@@ -817,7 +808,7 @@ bool authorise_login(struct smbd_server_connection *sconn,
                        } else {
                                fstring user2;
                                fstrcpy(user2,auser);
-                               if (user_ok(sconn,user2,snum) &&
+                               if (user_ok(user2,snum) &&
                                    password_ok(actx, enc,
                                                get_session_workgroup(sconn),
                                                user2,password)) {
@@ -853,7 +844,7 @@ bool authorise_login(struct smbd_server_connection *sconn,
                *guest = True;
        }
 
-       if (ok && !user_ok(sconn, user, snum)) {
+       if (ok && !user_ok(user, snum)) {
                DEBUG(0,("authorise_login: rejected invalid user %s\n",user));
                ok = False;
        }
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index c849757..3396f89 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -3061,9 +3061,6 @@ void smbd_process(void)
        smbd_server_conn->smb1.sessions.validated_users = NULL;
        smbd_server_conn->smb1.sessions.next_vuid = VUID_OFFSET;
        smbd_server_conn->smb1.sessions.num_validated_vuids = 0;
-#ifdef HAVE_NETGROUP
-       smbd_server_conn->smb1.sessions.my_yp_domain = NULL;
-#endif
 
        conn_init(smbd_server_conn);
        if (!init_dptrs(smbd_server_conn)) {
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index afd9cad..8642544 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -306,7 +306,6 @@ int add_home_service(const char *service, const char 
*username, const char *home
 int find_service(fstring service)
 {
        int iService;
-       struct smbd_server_connection *sconn = smbd_server_conn;
 
        all_string_sub(service,"\\","/",0);
 
@@ -321,7 +320,7 @@ int find_service(fstring service)
                         * Try mapping the servicename, it may
                         * be a Windows to unix mapped user name.
                         */
-                       if(map_username(sconn, service))
+                       if(map_username(service))
                                phome_dir = get_user_home_dir(
                                        talloc_tos(), service);
                }
@@ -1158,7 +1157,7 @@ connection_struct *make_connection(struct 
smbd_server_connection *sconn,
                                fstring unix_username;
                                fstrcpy(unix_username,
                                        current_user_info.smb_name);
-                               map_username(sconn, unix_username);
+                               map_username(unix_username);
                                snum = find_service(unix_username);
                        } 
                        if (snum != -1) {
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 7f99d62..dba6dab 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -413,7 +413,7 @@ static void reply_spnego_kerberos(struct smb_request *req,
 
        /* lookup the passwd struct, create a new user if necessary */
 
-       username_was_mapped = map_username(sconn, user);
+       username_was_mapped = map_username(user);
 
        pw = smb_getpwnam( mem_ctx, user, real_username, True );
 
@@ -1676,7 +1676,7 @@ void reply_sesssetup_and_X(struct smb_request *req)
                data_blob_free(&nt_resp);
                data_blob_clear_free(&plaintext_password);
 
-               map_username(sconn, sub_user);
+               map_username(sub_user);
                add_session_user(sconn, sub_user);
                add_session_workgroup(sconn, domain);
                /* Then force it to null for the benfit of the code below */
diff --git a/source3/smbd/share_access.c b/source3/smbd/share_access.c
index 9800e4f..d41b05d 100644
--- a/source3/smbd/share_access.c
+++ b/source3/smbd/share_access.c
@@ -131,7 +131,7 @@ static bool token_contains_name(TALLOC_CTX *mem_ctx,
                }
                if (*prefix == '&') {
                        if (username) {
-                               if (user_in_netgroup(sconn, username, name)) {
+                               if (user_in_netgroup(username, name)) {
                                        return True;
                                }
                        }
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index d91d0fe..88454c1 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -170,7 +170,6 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct 
smbd_smb2_session *session,
        fstring tmp;
        bool username_was_mapped = false;
        bool map_domainuser_to_guest = false;
-       struct smbd_server_connection *sconn = smbd_server_conn;
 
        if (!spnego_parse_krb5_wrap(*secblob, &ticket, tok_id)) {
                status = NT_STATUS_LOGON_FAILURE;
@@ -265,7 +264,7 @@ static NTSTATUS smbd_smb2_session_setup_krb5(struct 
smbd_smb2_session *session,
 
        /* lookup the passwd struct, create a new user if necessary */
 
-       username_was_mapped = map_username(sconn, user);
+       username_was_mapped = map_username(user);
 
        pw = smb_getpwnam(talloc_tos(), user, real_username, true );
        if (pw) {


-- 
Samba Shared Repository

Reply via email to