summaryrefslogtreecommitdiff
path: root/source3/include/passdb.h
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-02-20 20:09:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:10:15 -0500
commit2203bed32c84c63737f402accf73452efb76b483 (patch)
tree76259a35b1137cfa89547b80b2b93eb0eedf5bcf /source3/include/passdb.h
parent69b2669b559c009d17f621cbc7c6937eafc56af6 (diff)
downloadsamba-2203bed32c84c63737f402accf73452efb76b483.tar.gz
samba-2203bed32c84c63737f402accf73452efb76b483.tar.bz2
samba-2203bed32c84c63737f402accf73452efb76b483.zip
r13576: This is the beginnings of moving the SAM_ACCOUNT data structure
to make full use of the new talloc() interface. Discussed with Volker and Jeremy. * remove the internal mem_ctx and simply use the talloc() structure as the context. * replace the internal free_fn() with a talloc_destructor() function * remove the unnecessary private nested structure * rename SAM_ACCOUNT to 'struct samu' to indicate the current an upcoming changes. Groups will most likely be replaced with a 'struct samg' in the future. Note that there are now passbd API changes. And for the most part, the wrapper functions remain the same. While this code has been tested on tdb and ldap based Samba PDC's as well as Samba member servers, there are probably still some bugs. The code also needs more testing under valgrind to ensure it's not leaking memory. But it's a start...... (This used to be commit 19b7593972480540283c5bf02c02e5ecd8d2c3f0)
Diffstat (limited to 'source3/include/passdb.h')
-rw-r--r--source3/include/passdb.h128
1 files changed, 60 insertions, 68 deletions
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 79ba391867..68165ca3d5 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -62,7 +62,7 @@
#define ACCT_OWF_PWD 0x20000000
/*
- * bit flags representing initialized fields in SAM_ACCOUNT
+ * bit flags representing initialized fields in struct samu
*/
enum pdb_elements {
PDB_UNINIT,
@@ -135,70 +135,62 @@ typedef struct logon_cache_struct {
time_t bad_password_time;
} LOGIN_CACHE;
-typedef struct sam_passwd {
- TALLOC_CTX *mem_ctx;
-
- void (*free_fn)(struct sam_passwd **);
-
+struct samu {
struct pdb_methods *methods;
- struct user_data {
- /* initialization 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 bad_password_time; /* last bad password entered */
- 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 */
+ /* initialization 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 bad_password_time; /* last bad password entered */
+ 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 */
+ 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 */
+ 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 */
- DATA_BLOB nt_pw_his; /* nt hashed password history .data is Null if not available */
- char* plaintext_pw; /* is Null if not available */
+ DATA_BLOB lm_pw; /* .data is Null if no password */
+ DATA_BLOB nt_pw; /* .data is Null if no password */
+ DATA_BLOB nt_pw_his; /* nt hashed password history .data is Null if not available */
+ char* plaintext_pw; /* is Null if not available */
- uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
- uint32 fields_present; /* 0x00ff ffff */
+ uint16 acct_ctrl; /* account info (ACB_xxxx bit-mask) */
+ uint32 fields_present; /* 0x00ff ffff */
- uint16 logon_divs; /* 168 - number of hours in a week */
- uint32 hours_len; /* normally 21 bytes */
- uint8 hours[MAX_HOURS_LEN];
-
- /* Was unknown_5. */
- uint16 bad_password_count;
- uint16 logon_count;
-
- uint32 unknown_6; /* 0x0000 04ec */
- /* a tag for who added the private methods */
- const struct pdb_methods *backend_private_methods;
- void *backend_private_data;
- void (*backend_private_data_free_fn)(void **);
- } private_u;
-
- /* Lets see if the remaining code can get the hint that you
- are meant to use the pdb_...() functions. */
+ uint16 logon_divs; /* 168 - number of hours in a week */
+ uint32 hours_len; /* normally 21 bytes */
+ uint8 hours[MAX_HOURS_LEN];
-} SAM_ACCOUNT;
+ /* Was unknown_5. */
+ uint16 bad_password_count;
+ uint16 logon_count;
+
+ uint32 unknown_6; /* 0x0000 04ec */
+
+ /* a tag for who added the private methods */
+ const struct pdb_methods *backend_private_methods;
+ void *backend_private_data;
+ void (*backend_private_data_free_fn)(void **);
+
+};
struct acct_info {
fstring acct_name; /* account name */
@@ -257,28 +249,28 @@ struct pdb_methods
void (*endsampwent)(struct pdb_methods *);
- NTSTATUS (*getsampwent)(struct pdb_methods *, SAM_ACCOUNT *user);
+ NTSTATUS (*getsampwent)(struct pdb_methods *, struct samu *user);
- NTSTATUS (*getsampwnam)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const char *username);
+ NTSTATUS (*getsampwnam)(struct pdb_methods *, struct samu *sam_acct, const char *username);
- NTSTATUS (*getsampwsid)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const DOM_SID *sid);
+ NTSTATUS (*getsampwsid)(struct pdb_methods *, struct samu *sam_acct, const DOM_SID *sid);
NTSTATUS (*create_user)(struct pdb_methods *, TALLOC_CTX *tmp_ctx,
const char *name, uint32 acct_flags,
uint32 *rid);
NTSTATUS (*delete_user)(struct pdb_methods *, TALLOC_CTX *tmp_ctx,
- SAM_ACCOUNT *sam_acct);
+ struct samu *sam_acct);
- NTSTATUS (*add_sam_account)(struct pdb_methods *, SAM_ACCOUNT *sampass);
+ NTSTATUS (*add_sam_account)(struct pdb_methods *, struct samu *sampass);
- NTSTATUS (*update_sam_account)(struct pdb_methods *, SAM_ACCOUNT *sampass);
+ NTSTATUS (*update_sam_account)(struct pdb_methods *, struct samu *sampass);
- NTSTATUS (*delete_sam_account)(struct pdb_methods *, SAM_ACCOUNT *username);
+ NTSTATUS (*delete_sam_account)(struct pdb_methods *, struct samu *username);
- NTSTATUS (*rename_sam_account)(struct pdb_methods *, SAM_ACCOUNT *oldname, const char *newname);
+ NTSTATUS (*rename_sam_account)(struct pdb_methods *, struct samu *oldname, const char *newname);
- NTSTATUS (*update_login_attempts)(struct pdb_methods *methods, SAM_ACCOUNT *sam_acct, BOOL success);
+ NTSTATUS (*update_login_attempts)(struct pdb_methods *methods, struct samu *sam_acct, BOOL success);
NTSTATUS (*getgrsid)(struct pdb_methods *methods, GROUP_MAP *map, DOM_SID sid);
@@ -315,13 +307,13 @@ struct pdb_methods
NTSTATUS (*enum_group_memberships)(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *user,
+ struct samu *user,
DOM_SID **pp_sids, gid_t **pp_gids,
size_t *p_num_groups);
NTSTATUS (*set_unix_primary_group)(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,
- SAM_ACCOUNT *user);
+ struct samu *user);
NTSTATUS (*add_groupmem)(struct pdb_methods *methods,
TALLOC_CTX *mem_ctx,