summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2003-05-04 23:41:51 +0000
committerSimo Sorce <idra@samba.org>2003-05-04 23:41:51 +0000
commita5cc68290e018fcdc077ca143ae508191b952ff0 (patch)
tree35d5445aba5e85ac3447d0479c1fa0ef5c9e7964 /source3
parent9748661b7142400e5ff10cb1478d481b28c12abb (diff)
downloadsamba-a5cc68290e018fcdc077ca143ae508191b952ff0.tar.gz
samba-a5cc68290e018fcdc077ca143ae508191b952ff0.tar.bz2
samba-a5cc68290e018fcdc077ca143ae508191b952ff0.zip
move some things around
(This used to be commit a4fc9c3b2dfbdbb3f75bf38415741ff66dbe1367)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/includes.h3
-rw-r--r--source3/include/mapping.h1
-rw-r--r--source3/include/passdb.h197
-rw-r--r--source3/include/smb.h108
4 files changed, 171 insertions, 138 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 9f86f08c1e..a54c302738 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -767,8 +767,11 @@ extern int errno;
#include "debugparse.h"
#include "version.h"
+
#include "smb.h"
+
#include "smbw.h"
+
#include "nameserv.h"
#include "secrets.h"
diff --git a/source3/include/mapping.h b/source3/include/mapping.h
index d4f2d28e6a..0cb31aa040 100644
--- a/source3/include/mapping.h
+++ b/source3/include/mapping.h
@@ -43,7 +43,6 @@
typedef struct _GROUP_MAP {
- struct pdb_methods *methods;
gid_t gid;
DOM_SID sid;
enum SID_NAME_USE sid_name_use;
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 35399758b2..f27c1e159c 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -3,6 +3,8 @@
passdb structures and parameters
Copyright (C) Gerald Carter 2001
Copyright (C) Luke Kenneth Casson Leighton 1998 - 2000
+ Copyright (C) Andrew Bartlett 2002
+ Copyright (C) Simo Sorce 2003
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +25,149 @@
#define _PASSDB_H
+/*
+ * bit flags representing initialized fields in SAM_ACCOUNT
+ */
+enum pdb_elements {
+ PDB_UNINIT,
+ PDB_SMBHOME,
+ PDB_PROFILE,
+ PDB_DRIVE,
+ PDB_LOGONSCRIPT,
+ PDB_LOGONTIME,
+ PDB_LOGOFFTIME,
+ PDB_KICKOFFTIME,
+ PDB_CANCHANGETIME,
+ PDB_MUSTCHANGETIME,
+ PDB_PLAINTEXT_PW,
+ PDB_USERNAME,
+ PDB_FULLNAME,
+ PDB_DOMAIN,
+ PDB_NTUSERNAME,
+ PDB_HOURSLEN,
+ PDB_LOGONDIVS,
+ PDB_USERSID,
+ PDB_GROUPSID,
+ PDB_ACCTCTRL,
+ PDB_PASSLASTSET,
+ PDB_UNIXHOMEDIR,
+ PDB_ACCTDESC,
+ PDB_WORKSTATIONS,
+ PDB_UNKNOWNSTR,
+ PDB_MUNGEDDIAL,
+ PDB_HOURS,
+ PDB_UNKNOWN3,
+ PDB_UNKNOWN5,
+ PDB_UNKNOWN6,
+ PDB_LMPASSWD,
+ PDB_NTPASSWD,
+
+ /* this must be the last element */
+ PDB_COUNT
+};
+
+enum pdb_group_elements {
+ PDB_GROUP_NAME,
+ PDB_GROUP_SID,
+ PDB_GROUP_SID_NAME_USE,
+ PDB_GROUP_MEMBERS,
+
+ /* this must be the last element */
+ PDB_GROUP_COUNT
+};
+
+
+enum pdb_value_state {
+ PDB_DEFAULT=0,
+ PDB_SET,
+ PDB_CHANGED
+};
+
+#define IS_SAM_SET(x, flag) (pdb_get_init_flags(x, flag) == PDB_SET)
+#define IS_SAM_CHANGED(x, flag) (pdb_get_init_flags(x, flag) == PDB_CHANGED)
+#define IS_SAM_DEFAULT(x, flag) (pdb_get_init_flags(x, flag) == PDB_DEFAULT)
+
+typedef struct sam_passwd
+{
+ TALLOC_CTX *mem_ctx;
+
+ void (*free_fn)(struct sam_passwd **);
+
+ struct pdb_methods *methods;
+
+ struct user_data {
+ /* initiailization flags */
+ struct bitmap *change_flags;
+ struct bitmap *set_flags;
+
+ time_t logon_time; /* logon time */
+ time_t logoff_time; /* logoff time */
+ time_t kickoff_time; /* kickoff time */
+ time_t pass_last_set_time; /* password last set time */
+ time_t pass_can_change_time; /* password can change time */
+ time_t pass_must_change_time; /* password must change time */
+
+ const char * username; /* UNIX username string */
+ const char * domain; /* Windows Domain name */
+ const char * nt_username; /* Windows username string */
+ const char * full_name; /* user's full name string */
+ const char * unix_home_dir; /* UNIX home directory string */
+ const char * home_dir; /* home directory string */
+ const char * dir_drive; /* home directory drive string */
+ const char * logon_script; /* logon script string */
+ const char * profile_path; /* profile path string */
+ const char * acct_desc ; /* user description string */
+ const char * workstations; /* login from workstations string */
+ const char * unknown_str ; /* don't know what this is, yet. */
+ const char * munged_dial ; /* munged path name and dial-back tel number */
+
+ DOM_SID user_sid; /* Primary User SID */
+ DOM_SID group_sid; /* Primary Group SID */
+
+ DATA_BLOB lm_pw; /* .data is Null if no password */
+ DATA_BLOB nt_pw; /* .data is Null if no password */
+ char* plaintext_pw; /* is Null if not available */
+
+ uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
+ uint32 unknown_3; /* 0x00ff ffff */
+
+ uint16 logon_divs; /* 168 - number of hours in a week */
+ uint32 hours_len; /* normally 21 bytes */
+ uint8 hours[MAX_HOURS_LEN];
+
+ uint32 unknown_5; /* 0x0002 0000 */
+ uint32 unknown_6; /* 0x0000 04ec */
+ } private;
+
+ /* Lets see if the remaining code can get the hint that you
+ are meant to use the pdb_...() functions. */
+
+} SAM_ACCOUNT;
+
+typedef struct sam_group {
+ TALLOC_CTX *mem_ctx;
+
+ void (*free_fn)(struct sam_group **);
+
+ struct pdb_methods *methods;
+
+ struct group_data {
+ /* initiailization flags */
+ struct bitmap *change_flags;
+ struct bitmap *set_flags;
+
+ const char *name; /* Windows group name string */
+
+ DOM_SID sid; /* Group SID */
+ enum SID_NAME_USE sid_name_use; /* Group type */
+
+ uint32 mem_num; /* Number of member SIDs */
+ DOM_SID *members; /* SID array */
+ } private;
+
+} SAM_GROUP;
+
+
/*****************************************************************
Functions to be implemented by the new (v2) passdb API
****************************************************************/
@@ -58,28 +203,24 @@ typedef struct pdb_context
NTSTATUS (*pdb_delete_sam_account)(struct pdb_context *, SAM_ACCOUNT *username);
- NTSTATUS (*pdb_getgrsid)(struct pdb_context *context, GROUP_MAP *map,
- DOM_SID sid, BOOL with_priv);
+ NTSTATUS (*pdb_getsamgrnam)(struct pdb_context *context, SAM_GROUP *samgroup, char *name);
- NTSTATUS (*pdb_getgrgid)(struct pdb_context *context, GROUP_MAP *map,
- gid_t gid, BOOL with_priv);
+ NTSTATUS (*pdb_getsamgrsid)(struct pdb_context *context, SAM_GROUP *samgroup, DOM_SID *sid);
- NTSTATUS (*pdb_getgrnam)(struct pdb_context *context, GROUP_MAP *map,
- char *name, BOOL with_priv);
+ NTSTATUS (*pdb_add_sam_group)(struct pdb_context *context, SAM_GROUP *samgroup);
- NTSTATUS (*pdb_add_group_mapping_entry)(struct pdb_context *context,
- GROUP_MAP *map);
+ NTSTATUS (*pdb_update_sam_group)(struct pdb_context *context, SAM_GROUP *samgroup);
- NTSTATUS (*pdb_update_group_mapping_entry)(struct pdb_context *context,
- GROUP_MAP *map);
+ NTSTATUS (*pdb_delete_sam_group)(struct pdb_context *context, DOM_SID *sid);
+
+ NTSTATUS (*pdb_add_sam_group_member)(struct pdb_context *context, DOM_SID *group_sid, DOM_SID *new_member_sid);
- NTSTATUS (*pdb_delete_group_mapping_entry)(struct pdb_context *context,
- DOM_SID sid);
+ NTSTATUS (*pdb_delete_sam_group_member)(struct pdb_context *context, DOM_SID *group_sid, DOM_SID *member_sid);
- NTSTATUS (*pdb_enum_group_mapping)(struct pdb_context *context,
+ NTSTATUS (*pdb_enum_sam_groups)(struct pdb_context *context,
enum SID_NAME_USE sid_name_use,
- GROUP_MAP **rmap, int *num_entries,
- BOOL unix_only, BOOL with_priv);
+ SAM_GROUP **groups, int *num_entries,
+ BOOL unix_only);
void (*free_fn)(struct pdb_context **);
@@ -112,27 +253,23 @@ typedef struct pdb_methods
NTSTATUS (*delete_sam_account)(struct pdb_methods *, SAM_ACCOUNT *username);
- NTSTATUS (*getgrsid)(struct pdb_methods *methods, GROUP_MAP *map,
- DOM_SID sid, BOOL with_priv);
-
- NTSTATUS (*getgrgid)(struct pdb_methods *methods, GROUP_MAP *map,
- gid_t gid, BOOL with_priv);
+ NTSTATUS (*getsamgrnam)(struct pdb_methods *methods, SAM_GROUP *samgroup, char *name);
- NTSTATUS (*getgrnam)(struct pdb_methods *methods, GROUP_MAP *map,
- char *name, BOOL with_priv);
+ NTSTATUS (*getsamgrsid)(struct pdb_methods *methods, SAM_GROUP *samgroup, DOM_SID *sid);
- NTSTATUS (*add_group_mapping_entry)(struct pdb_methods *methods,
- GROUP_MAP *map);
+ NTSTATUS (*add_sam_group)(struct pdb_methods *methods, SAM_GROUP *samgroup);
- NTSTATUS (*update_group_mapping_entry)(struct pdb_methods *methods,
- GROUP_MAP *map);
+ NTSTATUS (*update_sam_group)(struct pdb_methods *methods, SAM_GROUP *samgroup);
- NTSTATUS (*delete_group_mapping_entry)(struct pdb_methods *methods,
- DOM_SID sid);
+ NTSTATUS (*delete_sam_group)(struct pdb_methods *methods, DOM_SID sid);
- NTSTATUS (*enum_group_mapping)(struct pdb_methods *methods,
+ NTSTATUS (*add_sam_group_member)(struct pdb_methods *methods, DOM_SID *group_sid, DOM_SID *new_member_sid);
+
+ NTSTATUS (*delete_sam_group_member)(struct pdb_methods *methods, DOM_SID *group_sid, DOM_SID *member_sid);
+
+ NTSTATUS (*enum_sam_groups)(struct pdb_methods *methods,
enum SID_NAME_USE sid_name_use,
- GROUP_MAP **rmap, int *num_entries,
+ SAM_GROUP **groups, int *num_entries,
BOOL unix_only, BOOL with_priv);
void *private_data; /* Private data of some kind */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index a4df0e2697..c7a771b4da 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -585,113 +585,7 @@ typedef struct {
#define NT_HASH_LEN 16
#define LM_HASH_LEN 16
-/*
- * bit flags representing initialized fields in SAM_ACCOUNT
- */
-enum pdb_elements {
- PDB_UNINIT,
- PDB_SMBHOME,
- PDB_PROFILE,
- PDB_DRIVE,
- PDB_LOGONSCRIPT,
- PDB_LOGONTIME,
- PDB_LOGOFFTIME,
- PDB_KICKOFFTIME,
- PDB_CANCHANGETIME,
- PDB_MUSTCHANGETIME,
- PDB_PLAINTEXT_PW,
- PDB_USERNAME,
- PDB_FULLNAME,
- PDB_DOMAIN,
- PDB_NTUSERNAME,
- PDB_HOURSLEN,
- PDB_LOGONDIVS,
- PDB_USERSID,
- PDB_GROUPSID,
- PDB_ACCTCTRL,
- PDB_PASSLASTSET,
- PDB_UNIXHOMEDIR,
- PDB_ACCTDESC,
- PDB_WORKSTATIONS,
- PDB_UNKNOWNSTR,
- PDB_MUNGEDDIAL,
- PDB_HOURS,
- PDB_UNKNOWN3,
- PDB_UNKNOWN5,
- PDB_UNKNOWN6,
- PDB_LMPASSWD,
- PDB_NTPASSWD,
-
- /* this must be the last element */
- PDB_COUNT,
-};
-
-enum pdb_value_state {
- PDB_DEFAULT=0,
- PDB_SET,
- PDB_CHANGED
-};
-
-#define IS_SAM_SET(x, flag) (pdb_get_init_flags(x, flag) == PDB_SET)
-#define IS_SAM_CHANGED(x, flag) (pdb_get_init_flags(x, flag) == PDB_CHANGED)
-#define IS_SAM_DEFAULT(x, flag) (pdb_get_init_flags(x, flag) == PDB_DEFAULT)
-
-typedef struct sam_passwd
-{
- TALLOC_CTX *mem_ctx;
-
- void (*free_fn)(struct sam_passwd **);
-
- struct pdb_methods *methods;
-
- struct user_data {
- /* initiailization flags */
- struct bitmap *change_flags;
- struct bitmap *set_flags;
-
- time_t logon_time; /* logon time */
- time_t logoff_time; /* logoff time */
- time_t kickoff_time; /* kickoff time */
- time_t pass_last_set_time; /* password last set time */
- time_t pass_can_change_time; /* password can change time */
- time_t pass_must_change_time; /* password must change time */
-
- const char * username; /* UNIX username string */
- const char * domain; /* Windows Domain name */
- const char * nt_username; /* Windows username string */
- const char * full_name; /* user's full name string */
- const char * unix_home_dir; /* UNIX home directory string */
- const char * home_dir; /* home directory string */
- const char * dir_drive; /* home directory drive string */
- const char * logon_script; /* logon script string */
- const char * profile_path; /* profile path string */
- const char * acct_desc ; /* user description string */
- const char * workstations; /* login from workstations string */
- const char * unknown_str ; /* don't know what this is, yet. */
- const char * munged_dial ; /* munged path name and dial-back tel number */
-
- DOM_SID user_sid; /* Primary User SID */
- DOM_SID group_sid; /* Primary Group SID */
-
- DATA_BLOB lm_pw; /* .data is Null if no password */
- DATA_BLOB nt_pw; /* .data is Null if no password */
- char* plaintext_pw; /* is Null if not available */
-
- uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
- uint32 unknown_3; /* 0x00ff ffff */
-
- uint16 logon_divs; /* 168 - number of hours in a week */
- uint32 hours_len; /* normally 21 bytes */
- uint8 hours[MAX_HOURS_LEN];
-
- uint32 unknown_5; /* 0x0002 0000 */
- uint32 unknown_6; /* 0x0000 04ec */
- } private;
-
- /* Lets see if the remaining code can get the hint that you
- are meant to use the pdb_...() functions. */
-
-} SAM_ACCOUNT;
+#include "passdb.h"
/*
* Flags for account policy.