s3-auth: token_util needs system/passwd.h.
[mat/samba.git] / source3 / auth / token_util.c
index 025baa6e84db7aa0c566dae604cd7c310566b7e1..87f57b66ee5530c29ab730a855447cdbf6e234fc 100644 (file)
 /* functions moved from auth/auth_util.c to minimize linker deps */
 
 #include "includes.h"
+#include "system/passwd.h"
+#include "auth.h"
 #include "secrets.h"
 #include "memcache.h"
 #include "../librpc/gen_ndr/netlogon.h"
 #include "../libcli/security/security.h"
 #include "../lib/util/util_pw.h"
-#include "lib/winbind_util.h"
+#include "passdb.h"
+#include "lib/privileges.h"
 
 /****************************************************************************
  Check for a SID in an struct security_token
@@ -209,8 +212,8 @@ static NTSTATUS finalize_local_nt_token(struct security_token *result,
 
 NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx,
                                          bool is_guest,
-                                         struct netr_SamInfo3 *info3,
-                                         struct extra_auth_info *extra,
+                                         const struct netr_SamInfo3 *info3,
+                                         const struct extra_auth_info *extra,
                                          struct security_token **ntok)
 {
        struct security_token *usrtok = NULL;
@@ -336,7 +339,7 @@ struct security_token *create_local_nt_token(TALLOC_CTX *mem_ctx,
        DEBUG(10, ("Create local NT token for %s\n",
                   sid_string_dbg(user_sid)));
 
-       if (!(result = TALLOC_ZERO_P(mem_ctx, struct security_token))) {
+       if (!(result = talloc_zero(mem_ctx, struct security_token))) {
                DEBUG(0, ("talloc failed\n"));
                return NULL;
        }
@@ -691,9 +694,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
                num_group_sids = getgroups_num_group_sids;
 
                if (num_group_sids) {
-                       group_sids = TALLOC_ARRAY(tmp_ctx, struct dom_sid, num_group_sids);
+                       group_sids = talloc_array(tmp_ctx, struct dom_sid, num_group_sids);
                        if (group_sids == NULL) {
-                               DEBUG(1, ("TALLOC_ARRAY failed\n"));
+                               DEBUG(1, ("talloc_array failed\n"));
                                result = NT_STATUS_NO_MEMORY;
                                goto done;
                        }
@@ -730,9 +733,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
                }
 
                num_group_sids = 1;
-               group_sids = TALLOC_ARRAY(tmp_ctx, struct dom_sid, num_group_sids);
+               group_sids = talloc_array(tmp_ctx, struct dom_sid, num_group_sids);
                if (group_sids == NULL) {
-                       DEBUG(1, ("TALLOC_ARRAY failed\n"));
+                       DEBUG(1, ("talloc_array failed\n"));
                        result = NT_STATUS_NO_MEMORY;
                        goto done;
                }