#define ACCT_FULL_NAME 0x00000002
#define ACCT_RID 0x00000004
#define ACCT_PRIMARY_GID 0x00000008
-#define ACCT_ADMIN_DESC 0x00000010
-#define ACCT_DESCRIPTION 0x00000020
+#define ACCT_DESCRIPTION 0x00000010
+#define ACCT_COMMENT 0x00000020
#define ACCT_HOME_DIR 0x00000040
#define ACCT_HOME_DRIVE 0x00000080
#define ACCT_LOGON_SCRIPT 0x00000100
#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,
PDB_UNIXHOMEDIR,
PDB_ACCTDESC,
PDB_WORKSTATIONS,
- PDB_UNKNOWNSTR,
+ PDB_COMMENT,
PDB_MUNGEDDIAL,
PDB_HOURS,
PDB_FIELDS_PRESENT,
/* cache for bad password lockout data, to be used on replicated SAMs */
typedef struct logon_cache_struct {
time_t entry_timestamp;
- uint16 acct_ctrl;
+ uint32 acct_ctrl;
uint16 bad_password_count;
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 *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 *comment;
+ 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;
+ DOM_SID *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 */
+ uint32 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];
+
+ /* 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 **);
-} SAM_ACCOUNT;
+ /* maintain a copy of the user's struct passwd */
+
+ struct passwd *unix_pw;
+};
struct acct_info {
fstring acct_name; /* account name */
struct samr_displayentry {
uint32 idx;
uint32 rid;
- uint16 acct_flags;
+ uint32 acct_flags;
const char *account_name;
const char *fullname;
const char *description;
* There's no point in allocating arrays in
* samr_lookup_rids twice. It was done in the srv_samr_nt.c code as well as in
* the pdb module. Remove the latter, this might happen more often. VL.
+ * changed to version 14 to move lookup_rids and lookup_names to return
+ * enum SID_NAME_USE rather than uint32.
*/
-#define PASSDB_INTERFACE_VERSION 12
+#define PASSDB_INTERFACE_VERSION 14
struct pdb_methods
{
const char *name; /* What name got this module */
- NTSTATUS (*setsampwent)(struct pdb_methods *, BOOL update, uint16 acb_mask);
+ NTSTATUS (*setsampwent)(struct pdb_methods *, BOOL update, uint32 acb_mask);
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);
DOM_SID sid);
NTSTATUS (*enum_group_mapping)(struct pdb_methods *methods,
- enum SID_NAME_USE sid_name_use,
+ const DOM_SID *sid, enum SID_NAME_USE sid_name_use,
GROUP_MAP **pp_rmap, size_t *p_num_entries,
BOOL unix_only);
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,
int num_rids,
uint32 *rids,
const char **pp_names,
- uint32 *attrs);
+ enum SID_NAME_USE *attrs);
NTSTATUS (*lookup_names)(struct pdb_methods *methods,
const DOM_SID *domain_sid,
int num_names,
const char **pp_names,
uint32 *rids,
- uint32 *attrs);
+ enum SID_NAME_USE *attrs);
NTSTATUS (*get_account_policy)(struct pdb_methods *methods,
int policy_index, uint32 *value);
BOOL (*search_users)(struct pdb_methods *methods,
struct pdb_search *search,
- uint16 acct_flags);
+ uint32 acct_flags);
BOOL (*search_groups)(struct pdb_methods *methods,
struct pdb_search *search);
BOOL (*search_aliases)(struct pdb_methods *methods,
struct pdb_init_function_entry *prev, *next;
};
-enum sql_search_field { SQL_SEARCH_NONE = 0, SQL_SEARCH_USER_SID = 1, SQL_SEARCH_USER_NAME = 2};
-
#endif /* _PASSDB_H */