The branch, master has been updated
       via  303962e s3: Fix smbcontrol smbd idmap kill S-1-5-21-...
       via  76ba678 s3: Reformat msg_idmap.c to match Samba coding
      from  d7eb4a4 libcli/smb: add PROTOCOL_SMB2_10

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


- Log -----------------------------------------------------------------
commit 303962e3708266810996cde496a6f87b7b4c4bc6
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Sep 5 13:11:59 2011 +0200

    s3: Fix smbcontrol smbd idmap kill S-1-5-21-...
    
    The calls to sid_to_gid and sid_to_uid create id mapping entries themselves,
    which makes it pretty difficult to reliably delete id mapping entries
    everywhere just using a SID.
    
    Autobuild-User: Volker Lendecke <vlen...@samba.org>
    Autobuild-Date: Mon Sep  5 16:30:41 CEST 2011 on sn-devel-104

commit 76ba67862f9615ca325d4118496837ca27c710e0
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Sep 5 13:02:54 2011 +0200

    s3: Reformat msg_idmap.c to match Samba coding

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

Summary of changes:
 source3/smbd/msg_idmap.c |   58 +++++++++++++++++++++++++++++++---------------
 1 files changed, 39 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/msg_idmap.c b/source3/smbd/msg_idmap.c
index 702f545..dbd151d 100644
--- a/source3/smbd/msg_idmap.c
+++ b/source3/smbd/msg_idmap.c
@@ -21,16 +21,18 @@
 #include "smbd/globals.h"
 #include "smbd/smbd.h"
 #include "../libcli/security/dom_sid.h"
+#include "../libcli/security/security_token.h"
 #include "idmap_cache.h"
 #include "passdb/lookup_sid.h"
 #include "auth.h"
 #include "messages.h"
 #include "lib/id_cache.h"
 
-static bool uid_in_use(const struct user_struct* user, uid_t uid)
+static bool uid_in_use(const struct user_struct *user, uid_t uid)
 {
        while (user) {
-               if (user->session_info && (user->session_info->unix_token->uid 
== uid)) {
+               if (user->session_info &&
+                   (user->session_info->unix_token->uid == uid)) {
                        return true;
                }
                user = user->next;
@@ -38,12 +40,14 @@ static bool uid_in_use(const struct user_struct* user, 
uid_t uid)
        return false;
 }
 
-static bool gid_in_use(const struct user_struct* user, gid_t gid)
+static bool gid_in_use(const struct user_struct *user, gid_t gid)
 {
        while (user) {
                if (user->session_info != NULL) {
                        int i;
-                       struct security_unix_token *utok = 
user->session_info->unix_token;
+                       struct security_unix_token *utok;
+
+                       utok = user->session_info->unix_token;
                        if (utok->gid == gid) {
                                return true;
                        }
@@ -58,20 +62,34 @@ static bool gid_in_use(const struct user_struct* user, 
gid_t gid)
        return false;
 }
 
-static bool sid_in_use(const struct user_struct* user, const struct dom_sid* 
psid)
+static bool sid_in_use(const struct user_struct *user,
+                      const struct dom_sid *psid)
 {
-       uid_t uid;
-       gid_t gid;
-       if (sid_to_gid(psid, &gid)) {
-               return gid_in_use(user, gid);
-       } else if (sid_to_uid(psid, &uid)) {
-               return uid_in_use(user, uid);
+       while (user) {
+               struct security_token *tok;
+
+               if (user->session_info == NULL) {
+                       continue;
+               }
+               tok = user->session_info->security_token;
+               if (tok == NULL) {
+                       /*
+                        * Not sure session_info->security_token can
+                        * ever be NULL. This check might be not
+                        * necessary.
+                        */
+                       continue;
+               }
+               if (security_token_has_sid(tok, psid)) {
+                       return true;
+               }
+               user = user->next;
        }
        return false;
 }
 
-static bool id_in_use(const struct user_struct* user,
-                     const struct id_cache_ref* id)
+static bool id_in_use(const struct user_struct *user,
+                     const struct id_cache_ref *id)
 {
        switch(id->type) {
        case UID:
@@ -87,13 +105,15 @@ static bool id_in_use(const struct user_struct* user,
 }
 
 static void id_cache_kill(struct messaging_context *msg_ctx,
-                                void *private_data,
-                                uint32_t msg_type,
-                                struct server_id server_id,
-                                DATA_BLOB* data)
+                         void *private_data,
+                         uint32_t msg_type,
+                         struct server_id server_id,
+                         DATA_BLOB* data)
 {
-       const char *msg = (data && data->data) ? (const char *)data->data : 
"<NULL>";
-       struct user_struct *validated_users = 
smbd_server_conn->smb1.sessions.validated_users;
+       const char *msg = (data && data->data)
+               ? (const char *)data->data : "<NULL>";
+       struct user_struct *validated_users =
+               smbd_server_conn->smb1.sessions.validated_users;
        struct id_cache_ref id;
 
        if (!id_cache_ref_parse(msg, &id)) {


-- 
Samba Shared Repository

Reply via email to