[SCM] Samba Shared Repository - branch v3-6-test updated
Günther Deschner
gd at samba.org
Wed Apr 6 05:54:26 MDT 2011
The branch, v3-6-test has been updated
via 16da273 s3: Fix tldap_make_mod_blob_int() debug messages
via 32602f9 s3-net: Add delete op for net trust utility
via 175a2e7 s3-net: Add net trust utility
via bae5226 s3-pdb_ipa: Create DN for new object
via 939294c s3-pdb_ipa: Add ipasam_create_dom_group()
via 03773b1 s3-net: add IPA provision
via f16efc8 s3-pdb_ipa: Add ipasam_create_user()
via bf6ecce s3-pdb_ipa: Detect IPA server
via 5dc3b5e s3-pdb_ipa: Use new smbldap_make_mod_blob() without a return value
via de7db3e s3-smbldap: make octet_strings/DATA_BLOBs const.
via 454b5e9 s3-smbldap: support storing octet_strings/DATA_BLOBs.
via 72412ff s3-ipasam: rename of smbldap_make_mod_blob to _smbldap_make_mod_blob.
via 8dc0e41 s3-pdb_ipa: Fix indentation
from a56727e s3/vfs_gpfs: s/syncops/gpfs
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit 16da273301431e02293bee7fb986afa6991161ab
Author: Sumit Bose <sbose at redhat.com>
Date: Mon Apr 4 13:46:18 2011 +0200
s3: Fix tldap_make_mod_blob_int() debug messages
Signed-off-by: Günther Deschner <gd at samba.org>
Autobuild-User: Günther Deschner <gd at samba.org>
Autobuild-Date: Wed Apr 6 13:10:30 CEST 2011 on sn-devel-104
(cherry picked from commit 3626579cc27cb03fba2100be1a2686651bd3f003)
commit 32602f9bab2507d9b9b8cafe67e5597939dcc94f
Author: Sumit Bose <sbose at redhat.com>
Date: Thu Mar 31 17:46:56 2011 +0200
s3-net: Add delete op for net trust utility
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit 2bafb4ccbb99dfde533acad7bf0162ca2618c716)
commit 175a2e7d3c160cfff4c1e136d28d343b349b395d
Author: Sumit Bose <sbose at redhat.com>
Date: Thu Mar 24 12:10:13 2011 +0100
s3-net: Add net trust utility
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit 11c342724fe23ef532063a7731c2a6d19614cf78)
commit bae5226b99af769682710f888c0d1475c26fe370
Author: Sumit Bose <sbose at redhat.com>
Date: Wed Mar 23 12:09:22 2011 +0100
s3-pdb_ipa: Create DN for new object
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit 6681e451c98cd1716b5a68a02e0840a7ae768c36)
commit 939294c4b36cf94072fe6a0994e6c32fee704169
Author: Sumit Bose <sbose at redhat.com>
Date: Fri Mar 18 11:39:37 2011 +0100
s3-pdb_ipa: Add ipasam_create_dom_group()
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit 1cbe59e174c3ea66dfb57ab7f4ea493168b4867e)
commit 03773b1da81581826d75407a2666d7a4ad38d3b3
Author: Sumit Bose <sbose at redhat.com>
Date: Fri Mar 18 11:37:15 2011 +0100
s3-net: add IPA provision
Signed-off-by: Günther Deschner <gd at samba.org>
commit f16efc8d32f6e9b60f3fcbdbe122583316864cb2
Author: Sumit Bose <sbose at redhat.com>
Date: Mon Apr 4 13:23:05 2011 +0200
s3-pdb_ipa: Add ipasam_create_user()
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit 2ee1d09f33a1076549e1d331ba23a31384aae150)
commit bf6ecce768ab2eac9f224ff09d7d5f9f7d39a333
Author: Sumit Bose <sbose at redhat.com>
Date: Mon Apr 4 13:20:19 2011 +0200
s3-pdb_ipa: Detect IPA server
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit c47df017dda71f9eecea74575c7d7292e543e5ec)
commit 5dc3b5ecad92aab1d52e0eeaa115437ec9f5e2f5
Author: Sumit Bose <sbose at redhat.com>
Date: Mon Apr 4 13:14:47 2011 +0200
s3-pdb_ipa: Use new smbldap_make_mod_blob() without a return value
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit ca22befb9c2f4bf96944fc70650435dc11b4ea3a)
commit de7db3e8c526d8d4037e231f9eeaec886a05b13b
Author: Sumit Bose <sbose at redhat.com>
Date: Mon Apr 4 14:16:44 2011 +0200
s3-smbldap: make octet_strings/DATA_BLOBs const.
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit f3b1a68f5f540fa3674c5594ad3ede1568bab6cb)
commit 454b5e9bb34641018f74a35c906c14bc229533bc
Author: Günther Deschner <gd at samba.org>
Date: Thu Oct 29 23:36:14 2009 +0100
s3-smbldap: support storing octet_strings/DATA_BLOBs.
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit c4974eec01d32f2c777aa3fca02210bb6c255d79)
commit 72412ff5707205283a4470266e5286c2ce736d1a
Author: Günther Deschner <gd at samba.org>
Date: Wed Apr 6 11:33:12 2011 +0200
s3-ipasam: rename of smbldap_make_mod_blob to _smbldap_make_mod_blob.
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit 02c6940964f8db0c7e78b9e6d8e4a7a404331285)
commit 8dc0e41e20d14491d9129bff4b59e9e919f47232
Author: Sumit Bose <sbose at redhat.com>
Date: Mon Apr 4 13:07:37 2011 +0200
s3-pdb_ipa: Fix indentation
Signed-off-by: Günther Deschner <gd at samba.org>
(cherry picked from commit db76adc308217e92ada425703cbdbfce289d009b)
-----------------------------------------------------------------------
Summary of changes:
source3/Makefile.in | 1 +
source3/include/smbldap.h | 4 +
source3/lib/smbldap.c | 112 ++++++--
source3/lib/tldap_util.c | 6 +-
source3/passdb/pdb_ipa.c | 628 +++++++++++++++++++++++++++++++++------
source3/utils/net_proto.h | 3 +
source3/utils/net_rpc.c | 8 +
source3/utils/net_rpc_trust.c | 654 +++++++++++++++++++++++++++++++++++++++++
source3/utils/net_sam.c | 136 ++++++++-
source3/wscript_build | 1 +
10 files changed, 1416 insertions(+), 137 deletions(-)
create mode 100644 source3/utils/net_rpc_trust.c
Changeset truncated at 500 lines:
diff --git a/source3/Makefile.in b/source3/Makefile.in
index e45fd36..3ada9f6 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1160,6 +1160,7 @@ NET_OBJ1 = utils/net.o utils/net_ads.o utils/net_help.o \
utils/net_serverid.o \
utils/net_eventlog.o \
utils/net_printing.o \
+ utils/net_rpc_trust.o \
$(LIBNDR_NTPRINTING_OBJ) \
$(LIBNDR_PREG_OBJ) \
$(LIBCLI_SPOOLSS_OBJ) \
diff --git a/source3/include/smbldap.h b/source3/include/smbldap.h
index 5be9a92..7bb9895 100644
--- a/source3/include/smbldap.h
+++ b/source3/include/smbldap.h
@@ -138,9 +138,13 @@ NTSTATUS smbldap_init(TALLOC_CTX *mem_ctx,
const char* get_attr_key2string( ATTRIB_MAP_ENTRY table[], int key );
const char** get_attr_list( TALLOC_CTX *mem_ctx, ATTRIB_MAP_ENTRY table[] );
void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value);
+void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char *attribute, const DATA_BLOB *newblob);
void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
LDAPMod ***mods,
const char *attribute, const char *newval);
+void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
+ LDAPMod ***mods,
+ const char *attribute, const DATA_BLOB *newblob);
bool smbldap_get_single_attribute (LDAP * ldap_struct, LDAPMessage * entry,
const char *attribute, char *value,
int max_len);
diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c
index 568a7ee..0c5ea98 100644
--- a/source3/lib/smbldap.c
+++ b/source3/lib/smbldap.c
@@ -505,7 +505,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
manage memory used by the array, by each struct, and values
***********************************************************************/
- void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value)
+static void smbldap_set_mod_internal(LDAPMod *** modlist, int modop, const char *attribute, const char *value, const DATA_BLOB *blob)
{
LDAPMod **mods;
int i;
@@ -556,7 +556,27 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
mods[i + 1] = NULL;
}
- if (value != NULL) {
+ if (blob && (modop & LDAP_MOD_BVALUES)) {
+ j = 0;
+ if (mods[i]->mod_bvalues != NULL) {
+ for (; mods[i]->mod_bvalues[j] != NULL; j++);
+ }
+ mods[i]->mod_bvalues = SMB_REALLOC_ARRAY(mods[i]->mod_bvalues, struct berval *, j + 2);
+
+ if (mods[i]->mod_bvalues == NULL) {
+ smb_panic("smbldap_set_mod: out of memory!");
+ /* notreached. */
+ }
+
+ mods[i]->mod_bvalues[j] = SMB_MALLOC_P(struct berval);
+ SMB_ASSERT(mods[i]->mod_bvalues[j] != NULL);
+
+ mods[i]->mod_bvalues[j]->bv_val = (char *)memdup(blob->data, blob->length);
+ SMB_ASSERT(mods[i]->mod_bvalues[j]->bv_val != NULL);
+ mods[i]->mod_bvalues[j]->bv_len = blob->length;
+
+ mods[i]->mod_bvalues[j + 1] = NULL;
+ } else if (value != NULL) {
char *utf8_value = NULL;
size_t converted_size;
@@ -585,17 +605,30 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
*modlist = mods;
}
+ void smbldap_set_mod (LDAPMod *** modlist, int modop, const char *attribute, const char *value)
+{
+ smbldap_set_mod_internal(modlist, modop, attribute, value, NULL);
+}
+
+ void smbldap_set_mod_blob(LDAPMod *** modlist, int modop, const char *attribute, const DATA_BLOB *value)
+{
+ smbldap_set_mod_internal(modlist, modop | LDAP_MOD_BVALUES, attribute, NULL, value);
+}
+
/**********************************************************************
Set attribute to newval in LDAP, regardless of what value the
attribute had in LDAP before.
*********************************************************************/
- void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
- LDAPMod ***mods,
- const char *attribute, const char *newval)
+static void smbldap_make_mod_internal(LDAP *ldap_struct, LDAPMessage *existing,
+ LDAPMod ***mods,
+ const char *attribute, int op,
+ const char *newval,
+ const DATA_BLOB *newblob)
{
char oldval[2048]; /* current largest allowed value is mungeddial */
bool existed;
+ DATA_BLOB oldblob = data_blob_null;
if (attribute == NULL) {
/* This can actually happen for ldapsam_compat where we for
@@ -604,24 +637,33 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
}
if (existing != NULL) {
- existed = smbldap_get_single_attribute(ldap_struct, existing, attribute, oldval, sizeof(oldval));
+ if (op & LDAP_MOD_BVALUES) {
+ existed = smbldap_talloc_single_blob(talloc_tos(), ldap_struct, existing, attribute, &oldblob);
+ } else {
+ existed = smbldap_get_single_attribute(ldap_struct, existing, attribute, oldval, sizeof(oldval));
+ }
} else {
existed = False;
*oldval = '\0';
}
- /* all of our string attributes are case insensitive */
-
- if (existed && newval && (StrCaseCmp(oldval, newval) == 0)) {
+ if (existed) {
+ bool equal = false;
+ if (op & LDAP_MOD_BVALUES) {
+ equal = (newblob && (data_blob_cmp(&oldblob, newblob) == 0));
+ } else {
+ /* all of our string attributes are case insensitive */
+ equal = (newval && (StrCaseCmp(oldval, newval) == 0));
+ }
- /* Believe it or not, but LDAP will deny a delete and
- an add at the same time if the values are the
- same... */
- DEBUG(10,("smbldap_make_mod: attribute |%s| not changed.\n", attribute));
- return;
- }
+ if (equal) {
+ /* Believe it or not, but LDAP will deny a delete and
+ an add at the same time if the values are the
+ same... */
+ DEBUG(10,("smbldap_make_mod: attribute |%s| not changed.\n", attribute));
+ return;
+ }
- if (existed) {
/* There has been no value before, so don't delete it.
* Here's a possible race: We might end up with
* duplicate attributes */
@@ -633,20 +675,48 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
* in Novell NDS. In NDS you have to first remove attribute and then
* you could add new value */
- DEBUG(10,("smbldap_make_mod: deleting attribute |%s| values |%s|\n", attribute, oldval));
- smbldap_set_mod(mods, LDAP_MOD_DELETE, attribute, oldval);
+ if (op & LDAP_MOD_BVALUES) {
+ DEBUG(10,("smbldap_make_mod: deleting attribute |%s| blob\n", attribute));
+ smbldap_set_mod_blob(mods, LDAP_MOD_DELETE, attribute, &oldblob);
+ } else {
+ DEBUG(10,("smbldap_make_mod: deleting attribute |%s| values |%s|\n", attribute, oldval));
+ smbldap_set_mod(mods, LDAP_MOD_DELETE, attribute, oldval);
+ }
}
/* Regardless of the real operation (add or modify)
we add the new value here. We rely on deleting
the old value, should it exist. */
- if ((newval != NULL) && (strlen(newval) > 0)) {
- DEBUG(10,("smbldap_make_mod: adding attribute |%s| value |%s|\n", attribute, newval));
- smbldap_set_mod(mods, LDAP_MOD_ADD, attribute, newval);
+ if (op & LDAP_MOD_BVALUES) {
+ if (newblob && newblob->length) {
+ DEBUG(10,("smbldap_make_mod: adding attribute |%s| blob\n", attribute));
+ smbldap_set_mod_blob(mods, LDAP_MOD_ADD, attribute, newblob);
+ }
+ } else {
+ if ((newval != NULL) && (strlen(newval) > 0)) {
+ DEBUG(10,("smbldap_make_mod: adding attribute |%s| value |%s|\n", attribute, newval));
+ smbldap_set_mod(mods, LDAP_MOD_ADD, attribute, newval);
+ }
}
}
+ void smbldap_make_mod(LDAP *ldap_struct, LDAPMessage *existing,
+ LDAPMod ***mods,
+ const char *attribute, const char *newval)
+{
+ smbldap_make_mod_internal(ldap_struct, existing, mods, attribute,
+ 0, newval, NULL);
+}
+
+ void smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *existing,
+ LDAPMod ***mods,
+ const char *attribute, const DATA_BLOB *newblob)
+{
+ smbldap_make_mod_internal(ldap_struct, existing, mods, attribute,
+ LDAP_MOD_BVALUES, NULL, newblob);
+}
+
/**********************************************************************
Some varients of the LDAP rebind code do not pass in the third 'arg'
pointer to a void*, so we try and work around it by assuming that the
diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c
index df68131..c041abc 100644
--- a/source3/lib/tldap_util.c
+++ b/source3/lib/tldap_util.c
@@ -237,7 +237,7 @@ static bool tldap_make_mod_blob_int(struct tldap_message *existing,
/* Believe it or not, but LDAP will deny a delete and
an add at the same time if the values are the
same... */
- DEBUG(10,("smbldap_make_mod_blob: attribute |%s| not "
+ DEBUG(10,("tldap_make_mod_blob_int: attribute |%s| not "
"changed.\n", attrib));
return true;
}
@@ -251,7 +251,7 @@ static bool tldap_make_mod_blob_int(struct tldap_message *existing,
* Novell NDS. In NDS you have to first remove attribute and
* then you could add new value */
- DEBUG(10, ("smbldap_make_mod_blob: deleting attribute |%s|\n",
+ DEBUG(10, ("tldap_make_mod_blob_int: deleting attribute |%s|\n",
attrib));
if (!tldap_add_mod_blobs(mem_ctx, pmods, pnum_mods,
TLDAP_MOD_DELETE,
@@ -265,7 +265,7 @@ static bool tldap_make_mod_blob_int(struct tldap_message *existing,
the old value, should it exist. */
if (newval.data != NULL) {
- DEBUG(10, ("smbldap_make_mod: adding attribute |%s| value len "
+ DEBUG(10, ("tldap_make_mod_blob_int: adding attribute |%s| value len "
"%d\n", attrib, (int)newval.length));
if (!tldap_add_mod_blobs(mem_ctx, pmods, pnum_mods,
TLDAP_MOD_ADD,
diff --git a/source3/passdb/pdb_ipa.c b/source3/passdb/pdb_ipa.c
index d19deef..c98f33e 100644
--- a/source3/passdb/pdb_ipa.c
+++ b/source3/passdb/pdb_ipa.c
@@ -22,9 +22,13 @@
#include "passdb.h"
#include "libcli/security/dom_sid.h"
#include "../librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/samr.h"
#include "smbldap.h"
+#define IPA_KEYTAB_SET_OID "2.16.840.1.113730.3.8.3.1"
+#define IPA_MAGIC_ID_STR "999"
+
#define LDAP_TRUST_CONTAINER "ou=system"
#define LDAP_ATTRIBUTE_CN "cn"
#define LDAP_ATTRIBUTE_TRUST_TYPE "sambaTrustType"
@@ -36,37 +40,65 @@
#define LDAP_ATTRIBUTE_TRUST_AUTH_INCOMING "sambaTrustAuthIncoming"
#define LDAP_ATTRIBUTE_SECURITY_IDENTIFIER "sambaSecurityIdentifier"
#define LDAP_ATTRIBUTE_TRUST_FOREST_TRUST_INFO "sambaTrustForestTrustInfo"
+#define LDAP_ATTRIBUTE_OBJECTCLASS "objectClass"
#define LDAP_OBJ_KRB_PRINCIPAL "krbPrincipal"
#define LDAP_OBJ_KRB_PRINCIPAL_AUX "krbPrincipalAux"
#define LDAP_ATTRIBUTE_KRB_PRINCIPAL "krbPrincipalName"
+#define LDAP_OBJ_IPAOBJECT "ipaObject"
+#define LDAP_OBJ_IPAHOST "ipaHost"
+#define LDAP_OBJ_POSIXACCOUNT "posixAccount"
+
+#define LDAP_OBJ_GROUPOFNAMES "groupOfNames"
+#define LDAP_OBJ_NESTEDGROUP "nestedGroup"
+#define LDAP_OBJ_IPAUSERGROUP "ipaUserGroup"
+#define LDAP_OBJ_POSIXGROUP "posixGroup"
+
+#define HAS_KRB_PRINCIPAL (1<<0)
+#define HAS_KRB_PRINCIPAL_AUX (1<<1)
+#define HAS_IPAOBJECT (1<<2)
+#define HAS_IPAHOST (1<<3)
+#define HAS_POSIXACCOUNT (1<<4)
+#define HAS_GROUPOFNAMES (1<<5)
+#define HAS_NESTEDGROUP (1<<6)
+#define HAS_IPAUSERGROUP (1<<7)
+#define HAS_POSIXGROUP (1<<8)
+
struct ipasam_privates {
+ bool server_is_ipa;
NTSTATUS (*ldapsam_add_sam_account)(struct pdb_methods *,
struct samu *sampass);
NTSTATUS (*ldapsam_update_sam_account)(struct pdb_methods *,
struct samu *sampass);
+ NTSTATUS (*ldapsam_create_user)(struct pdb_methods *my_methods,
+ TALLOC_CTX *tmp_ctx, const char *name,
+ uint32_t acb_info, uint32_t *rid);
+ NTSTATUS (*ldapsam_create_dom_group)(struct pdb_methods *my_methods,
+ TALLOC_CTX *tmp_ctx,
+ const char *name,
+ uint32_t *rid);
};
static bool ipasam_get_trusteddom_pw(struct pdb_methods *methods,
- const char *domain,
- char** pwd,
- struct dom_sid *sid,
- time_t *pass_last_set_time)
+ const char *domain,
+ char** pwd,
+ struct dom_sid *sid,
+ time_t *pass_last_set_time)
{
return false;
}
static bool ipasam_set_trusteddom_pw(struct pdb_methods *methods,
- const char* domain,
- const char* pwd,
- const struct dom_sid *sid)
+ const char* domain,
+ const char* pwd,
+ const struct dom_sid *sid)
{
return false;
}
static bool ipasam_del_trusteddom_pw(struct pdb_methods *methods,
- const char *domain)
+ const char *domain)
{
return false;
}
@@ -416,23 +448,6 @@ static bool smbldap_make_mod_uint32_t(LDAP *ldap_struct, LDAPMessage *entry,
return true;
}
-static bool smbldap_make_mod_blob(LDAP *ldap_struct, LDAPMessage *entry,
- LDAPMod ***mods, const char *attribute,
- DATA_BLOB blob)
-{
- char *dummy;
-
- dummy = base64_encode_data_blob(talloc_tos(), blob);
- if (dummy == NULL) {
- return false;
- }
-
- smbldap_make_mod(ldap_struct, entry, mods, attribute, dummy);
- TALLOC_FREE(dummy);
-
- return true;
-}
-
static NTSTATUS ipasam_set_trusted_domain(struct pdb_methods *methods,
const char* domain,
const struct pdb_trusted_domain *td)
@@ -505,33 +520,21 @@ static NTSTATUS ipasam_set_trusted_domain(struct pdb_methods *methods,
}
if (td->trust_auth_outgoing.data != NULL) {
- res = smbldap_make_mod_blob(priv2ld(ldap_state), entry,
- &mods,
- LDAP_ATTRIBUTE_TRUST_AUTH_OUTGOING,
- td->trust_auth_outgoing);
- if (!res) {
- return NT_STATUS_UNSUCCESSFUL;
- }
+ smbldap_make_mod_blob(priv2ld(ldap_state), entry, &mods,
+ LDAP_ATTRIBUTE_TRUST_AUTH_OUTGOING,
+ &td->trust_auth_outgoing);
}
if (td->trust_auth_incoming.data != NULL) {
- res = smbldap_make_mod_blob(priv2ld(ldap_state), entry,
- &mods,
- LDAP_ATTRIBUTE_TRUST_AUTH_INCOMING,
- td->trust_auth_incoming);
- if (!res) {
- return NT_STATUS_UNSUCCESSFUL;
- }
+ smbldap_make_mod_blob(priv2ld(ldap_state), entry, &mods,
+ LDAP_ATTRIBUTE_TRUST_AUTH_INCOMING,
+ &td->trust_auth_incoming);
}
if (td->trust_forest_trust_info.data != NULL) {
- res = smbldap_make_mod_blob(priv2ld(ldap_state), entry,
- &mods,
- LDAP_ATTRIBUTE_TRUST_FOREST_TRUST_INFO,
- td->trust_forest_trust_info);
- if (!res) {
- return NT_STATUS_UNSUCCESSFUL;
- }
+ smbldap_make_mod_blob(priv2ld(ldap_state), entry, &mods,
+ LDAP_ATTRIBUTE_TRUST_FOREST_TRUST_INFO,
+ &td->trust_forest_trust_info);
}
talloc_autofree_ldapmod(talloc_tos(), mods);
@@ -554,7 +557,7 @@ static NTSTATUS ipasam_set_trusted_domain(struct pdb_methods *methods,
}
static NTSTATUS ipasam_del_trusted_domain(struct pdb_methods *methods,
- const char *domain)
+ const char *domain)
{
int ret;
struct ldapsam_privates *ldap_state =
@@ -663,9 +666,9 @@ static NTSTATUS ipasam_enum_trusted_domains(struct pdb_methods *methods,
}
static NTSTATUS ipasam_enum_trusteddoms(struct pdb_methods *methods,
- TALLOC_CTX *mem_ctx,
- uint32_t *num_domains,
- struct trustdom_info ***domains)
+ TALLOC_CTX *mem_ctx,
+ uint32_t *num_domains,
+ struct trustdom_info ***domains)
{
NTSTATUS status;
struct pdb_trusted_domain **td;
@@ -715,7 +718,7 @@ static struct pdb_domain_info *pdb_ipasam_get_domain_info(struct pdb_methods *pd
{
struct pdb_domain_info *info;
NTSTATUS status;
- struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)pdb_methods->private_data;
+ struct ldapsam_privates *ldap_state = pdb_methods->private_data;
info = talloc(mem_ctx, struct pdb_domain_info);
if (info == NULL) {
@@ -734,7 +737,6 @@ static struct pdb_domain_info *pdb_ipasam_get_domain_info(struct pdb_methods *pd
}
strlower_m(info->dns_domain);
info->dns_forest = talloc_strdup(info, info->dns_domain);
-
sid_copy(&info->sid, &ldap_state->domain_sid);
status = GUID_from_string("testguid", &info->guid);
@@ -806,63 +808,327 @@ static NTSTATUS modify_ipa_password_exop(struct ldapsam_privates *ldap_state,
return NT_STATUS_OK;
}
-static NTSTATUS ipasam_add_objectclasses(struct ldapsam_privates *ldap_state,
- struct samu *sampass)
+static NTSTATUS ipasam_get_objectclasses(struct ldapsam_privates *ldap_state,
+ const char *dn, LDAPMessage *entry,
+ uint32_t *has_objectclass)
+{
+ char **objectclasses;
+ size_t c;
+
+ objectclasses = ldap_get_values(priv2ld(ldap_state), entry,
+ LDAP_ATTRIBUTE_OBJECTCLASS);
+ if (objectclasses == NULL) {
+ DEBUG(0, ("Entry [%s] does not have any objectclasses.\n", dn));
+ return NT_STATUS_INTERNAL_DB_CORRUPTION;
+ }
+
+ *has_objectclass = 0;
+ for (c = 0; objectclasses[c] != NULL; c++) {
+ if (strequal(objectclasses[c], LDAP_OBJ_KRB_PRINCIPAL)) {
+ *has_objectclass |= HAS_KRB_PRINCIPAL;
+ } else if (strequal(objectclasses[c],
+ LDAP_OBJ_KRB_PRINCIPAL_AUX)) {
+ *has_objectclass |= HAS_KRB_PRINCIPAL_AUX;
+ } else if (strequal(objectclasses[c], LDAP_OBJ_IPAOBJECT)) {
+ *has_objectclass |= HAS_IPAOBJECT;
+ } else if (strequal(objectclasses[c], LDAP_OBJ_IPAHOST)) {
+ *has_objectclass |= HAS_IPAHOST;
+ } else if (strequal(objectclasses[c], LDAP_OBJ_POSIXACCOUNT)) {
+ *has_objectclass |= HAS_POSIXACCOUNT;
+ } else if (strequal(objectclasses[c], LDAP_OBJ_GROUPOFNAMES)) {
+ *has_objectclass |= HAS_GROUPOFNAMES;
+ } else if (strequal(objectclasses[c], LDAP_OBJ_NESTEDGROUP)) {
+ *has_objectclass |= HAS_NESTEDGROUP;
+ } else if (strequal(objectclasses[c], LDAP_OBJ_IPAUSERGROUP)) {
+ *has_objectclass |= HAS_IPAUSERGROUP;
+ } else if (strequal(objectclasses[c], LDAP_OBJ_POSIXGROUP)) {
+ *has_objectclass |= HAS_POSIXGROUP;
+ }
+ }
+ ldap_value_free(objectclasses);
+
+ return NT_STATUS_OK;
+}
+
+enum obj_type {
+ IPA_NO_OBJ = 0,
+ IPA_USER_OBJ,
+ IPA_GROUP_OBJ
+};
+
+static NTSTATUS find_obj(struct ldapsam_privates *ldap_state, const char *name,
+ enum obj_type type, char **_dn,
+ uint32_t *_has_objectclass)
{
- char *dn;
- LDAPMod **mods = NULL;
int ret;
- char *princ;
- const char *domain;
- char *domain_with_dot;
+ char *username;
+ char *filter;
--
Samba Shared Repository
More information about the samba-cvs
mailing list