summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/passdb.h55
-rw-r--r--source3/passdb/pdb_interface.c141
2 files changed, 195 insertions, 1 deletions
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index d7f11781fe..c12cf10cf2 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -78,6 +78,15 @@ enum pdb_group_elements {
PDB_GROUP_COUNT
};
+enum pdb_trust_passwd_elements {
+ PDB_TRUST_PASS,
+ PDB_TRUST_SID,
+ PDB_TRUST_NAME,
+ PDB_TRUST_MODTIME,
+ PDB_TRUST_FLAGS,
+
+ PDB_TRUST_COUNT
+};
enum pdb_value_state {
PDB_DEFAULT=0,
@@ -186,6 +195,26 @@ typedef struct _GROUP_INFO {
} GROUP_INFO;
+typedef struct sam_trust_passwd {
+ TALLOC_CTX *mem_ctx;
+
+ void (*free_fn)(struct sam_trust_passwd **);
+
+ struct pdb_methods *methods;
+
+ struct trust_passwd_data {
+ uint16 flags; /* flags */
+ size_t uni_name_len; /* unicode name length */
+ smb_ucs2_t uni_name[32]; /* unicode domain name */
+ fstring pass; /* trust password */
+ time_t mod_time; /* last change time */
+ DOM_SID domain_sid; /* trusted domain sid */
+ } private;
+
+} SAM_TRUST_PASSWD;
+
+
+
/*****************************************************************
Functions to be implemented by the new (v2) passdb API
****************************************************************/
@@ -195,7 +224,7 @@ typedef struct _GROUP_INFO {
* this SAMBA will load. Increment this if *ANY* changes are made to the interface.
*/
-#define PASSDB_INTERFACE_VERSION 4
+#define PASSDB_INTERFACE_VERSION 5
typedef struct pdb_context
{
@@ -267,6 +296,18 @@ typedef struct pdb_context
NTSTATUS (*pdb_get_group_uids)(struct pdb_context *context, const DOM_SID *group, uid_t **members, int *num_members);
+ /* trust password functions */
+
+ NTSTATUS (*pdb_gettrustpwent)(struct pdb_context *context, SAM_TRUST_PASSWD *trust);
+
+ NTSTATUS (*pdb_gettrustpwsid)(struct pdb_context *context, SAM_TRUST_PASSWD *trust, const DOM_SID *sid);
+
+ NTSTATUS (*pdb_add_trust_passwd)(struct pdb_context *context, SAM_TRUST_PASSWD* trust);
+
+ NTSTATUS (*pdb_update_trust_passwd)(struct pdb_context *context, SAM_TRUST_PASSWD* trust);
+
+ NTSTATUS (*pdb_delete_trust_passwd)(struct pdb_context *context, SAM_TRUST_PASSWD* trust);
+
void (*free_fn)(struct pdb_context **);
TALLOC_CTX *mem_ctx;
@@ -347,6 +388,18 @@ typedef struct pdb_methods
void *private_data; /* Private data of some kind */
void (*free_private_data)(void **);
+
+ /* trust password functions */
+
+ NTSTATUS (*gettrustpwent)(struct pdb_methods *methods, SAM_TRUST_PASSWD *trust);
+
+ NTSTATUS (*gettrustpwsid)(struct pdb_methods *methods, SAM_TRUST_PASSWD *trust, const DOM_SID *sid);
+
+ NTSTATUS (*add_trust_passwd)(struct pdb_methods *methods, const SAM_TRUST_PASSWD* trust);
+
+ NTSTATUS (*update_trust_passwd)(struct pdb_methods *methods, const SAM_TRUST_PASSWD* trust);
+
+ NTSTATUS (*delete_trust_passwd)(struct pdb_methods *methods, const SAM_TRUST_PASSWD* trust);
} PDB_METHODS;
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index d548081e78..26cbb21ee9 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -385,6 +385,109 @@ static NTSTATUS context_enum_group_mapping(struct pdb_context *context,
num_entries, unix_only);
}
+static NTSTATUS context_gettrustpwent(struct pdb_context *context,
+ SAM_TRUST_PASSWD *trust)
+{
+ NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
+ struct pdb_methods *cur_methods;
+
+ if (!context) {
+ DEBUG(0, ("invalid pdb_context specified!\n"));
+ return ret;
+ }
+
+ cur_methods = context->pdb_methods;
+
+ while (cur_methods) {
+ ret = cur_methods->gettrustpwent(cur_methods, trust);
+ if (NT_STATUS_IS_OK(ret)) {
+ trust->methods = cur_methods;
+ return ret;
+ }
+ cur_methods = cur_methods->next;
+ }
+
+ return ret;
+}
+
+static NTSTATUS context_gettrustpwsid(struct pdb_context *context,
+ SAM_TRUST_PASSWD *trust,
+ const DOM_SID *sid)
+{
+ NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
+ struct pdb_methods *cur_methods;
+
+ if (!context) {
+ DEBUG(0, ("invalid pdb_context specified!\n"));
+ return ret;
+ }
+
+ cur_methods = context->pdb_methods;
+
+ while (cur_methods) {
+ ret = cur_methods->gettrustpwsid(cur_methods, trust, sid);
+ if (NT_STATUS_IS_OK(ret)) {
+ trust->methods = cur_methods;
+ return ret;
+ }
+ cur_methods = cur_methods->next;
+ }
+
+ return ret;
+}
+
+static NTSTATUS context_add_trust_passwd(struct pdb_context *context,
+ SAM_TRUST_PASSWD *trust)
+{
+ NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
+ struct pdb_methods *methods;
+
+ if (!context) {
+ DEBUG(0, ("invalid pdb_context specified!\n"));
+ return ret;
+ }
+
+ return context->pdb_methods->add_trust_passwd(context->pdb_methods, trust);
+}
+
+static NTSTATUS context_update_trust_passwd(struct pdb_context *context,
+ SAM_TRUST_PASSWD *trust)
+{
+ NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
+ struct pdb_methods *methods;
+
+ if (!context) {
+ DEBUG(0, ("invalid pdb_context specified!\n"));
+ return ret;
+ }
+
+ if (!trust || !trust->methods) {
+ DEBUG(0, ("invalid trust pointer specified!\n"));
+ return ret;
+ }
+
+ return trust->methods->update_trust_passwd(trust->methods, trust);
+}
+
+static NTSTATUS context_delete_trust_passwd(struct pdb_context *context,
+ SAM_TRUST_PASSWD *trust)
+{
+ NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
+ struct pdb_methods *methods;
+
+ if (!context) {
+ DEBUG(0, ("invalid pdb_context specified!\n"));
+ return ret;
+ }
+
+ if (!trust || !trust->methods) {
+ DEBUG(0, ("invalid trust pointer specified!\n"));
+ return ret;
+ }
+
+ return trust->methods->delete_trust_passwd(trust->methods, trust);
+}
+
/******************************************************************
Free and cleanup a pdb context, any associated data and anything
that the attached modules might have associated.
@@ -500,6 +603,11 @@ static NTSTATUS make_pdb_context(struct pdb_context **context)
(*context)->pdb_update_group_mapping_entry = context_update_group_mapping_entry;
(*context)->pdb_delete_group_mapping_entry = context_delete_group_mapping_entry;
(*context)->pdb_enum_group_mapping = context_enum_group_mapping;
+ (*context)->pdb_gettrustpwent = context_gettrustpwent;
+ (*context)->pdb_gettrustpwsid = context_gettrustpwsid;
+ (*context)->pdb_add_trust_passwd = context_add_trust_passwd;
+ (*context)->pdb_update_trust_passwd = context_update_trust_passwd;
+ (*context)->pdb_delete_trust_passwd = context_delete_trust_passwd;
(*context)->free_fn = free_pdb_context;
@@ -840,6 +948,33 @@ static void pdb_default_endsampwent(struct pdb_methods *methods)
return; /* NT_STATUS_NOT_IMPLEMENTED; */
}
+static NTSTATUS pdb_default_gettrustpwent(struct pdb_methods *methods, SAM_TRUST_PASSWD* trust)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS pdb_default_gettrustpwsid(struct pdb_methods *methods, SAM_TRUST_PASSWD* trust,
+ const DOM_SID* sid)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS pdb_default_add_trust_passwd(struct pdb_methods *methods, const SAM_TRUST_PASSWD* trust)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS pdb_default_update_trust_passwd(struct pdb_methods *methods, const SAM_TRUST_PASSWD* trust)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS pdb_default_delete_trust_passwd(struct pdb_methods *methods, const SAM_TRUST_PASSWD* trust)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+
NTSTATUS make_pdb_methods(TALLOC_CTX *mem_ctx, PDB_METHODS **methods)
{
*methods = talloc(mem_ctx, sizeof(struct pdb_methods));
@@ -866,6 +1001,12 @@ NTSTATUS make_pdb_methods(TALLOC_CTX *mem_ctx, PDB_METHODS **methods)
(*methods)->update_group_mapping_entry = pdb_default_update_group_mapping_entry;
(*methods)->delete_group_mapping_entry = pdb_default_delete_group_mapping_entry;
(*methods)->enum_group_mapping = pdb_default_enum_group_mapping;
+
+ (*methods)->gettrustpwent = pdb_default_gettrustpwent;
+ (*methods)->gettrustpwsid = pdb_default_gettrustpwsid;
+ (*methods)->add_trust_passwd = pdb_default_add_trust_passwd;
+ (*methods)->update_trust_passwd = pdb_default_update_trust_passwd;
+ (*methods)->delete_trust_passwd = pdb_default_delete_trust_passwd;
return NT_STATUS_OK;
}