The branch, v3-2-test has been updated
       via  5bbceac88159ef6ff83d9cc62c77c7af2116967d (commit)
       via  65537eae842065a1dd68d8e532e61502b61e1dbe (commit)
       via  4deef80bed374af5032c0f3081d2ee3c70be99df (commit)
       via  62e7d467ab1b2f98327960eec3a3a925b2f04bda (commit)
      from  77713e776405800ac54c692a77cd4efd153042cb (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 5bbceac88159ef6ff83d9cc62c77c7af2116967d
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Thu Jan 3 17:28:09 2008 +0100

    Add ads_get_joinable_ous().
    
    Guenther

commit 65537eae842065a1dd68d8e532e61502b61e1dbe
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Thu Jan 3 16:46:26 2008 +0100

    Use different error code for libnet_conf initialization failure.
    
    Guenther

commit 4deef80bed374af5032c0f3081d2ee3c70be99df
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Thu Jan 3 16:41:38 2008 +0100

    Minor libnetapi join cosmetic cleanup.
    
    Guenther

commit 62e7d467ab1b2f98327960eec3a3a925b2f04bda
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Thu Jan 3 16:40:04 2008 +0100

    Add some more join related werror codes.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/include/ads_protos.h    |    4 ++
 source/include/doserr.h        |    2 +
 source/lib/netapi/joindomain.c |    6 ++--
 source/libads/ldap.c           |   60 ++++++++++++++++++++++++++++++++++++++++
 source/libnet/libnet_conf.c    |    3 +-
 source/libsmb/doserr.c         |    3 ++
 6 files changed, 73 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/ads_protos.h b/source/include/ads_protos.h
index 0292d91..738df3e 100644
--- a/source/include/ads_protos.h
+++ b/source/include/ads_protos.h
@@ -114,3 +114,7 @@ ADS_STATUS ads_get_tokensids(ADS_STRUCT *ads,
                              DOM_SID *primary_group_sid,
                              DOM_SID **sids,
                              size_t *num_sids);
+ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
+                               TALLOC_CTX *mem_ctx,
+                               char ***ous,
+                               size_t *num_ous);
diff --git a/source/include/doserr.h b/source/include/doserr.h
index 079a566..08f5b3e 100644
--- a/source/include/doserr.h
+++ b/source/include/doserr.h
@@ -216,12 +216,14 @@
 #define WERR_BUF_TOO_SMALL W_ERROR(2123)
 #define WERR_JOB_NOT_FOUND W_ERROR(2151)
 #define WERR_DEST_NOT_FOUND W_ERROR(2152)
+#define WERR_USER_EXISTS W_ERROR(2224)
 #define WERR_NOT_LOCAL_DOMAIN W_ERROR(2320)
 #define WERR_DOMAIN_CONTROLLER_NOT_FOUND W_ERROR(2453)
 
 #define WERR_SETUP_ALREADY_JOINED W_ERROR(2691)
 #define WERR_SETUP_NOT_JOINED W_ERROR(2692)
 #define WERR_SETUP_DOMAIN_CONTROLLER W_ERROR(2693)
+#define WERR_DEFAULT_JOIN_REQUIRED W_ERROR(2694)
 
 #define WERR_DEVICE_NOT_AVAILABLE W_ERROR(4319)
 #define WERR_STATUS_MORE_ENTRIES   W_ERROR(0x0105)
diff --git a/source/lib/netapi/joindomain.c b/source/lib/netapi/joindomain.c
index 60f48a7..d200c9b 100644
--- a/source/lib/netapi/joindomain.c
+++ b/source/lib/netapi/joindomain.c
@@ -114,7 +114,7 @@ static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx,
        if (!pipe_cli) {
                werr = ntstatus_to_werror(status);
                goto done;
-       };
+       }
 
        if (password) {
                encode_wkssvc_join_password_buffer(ctx,
@@ -300,7 +300,7 @@ static WERROR NetUnjoinDomainRemote(struct libnetapi_ctx 
*ctx,
        if (!pipe_cli) {
                werr = ntstatus_to_werror(status);
                goto done;
-       };
+       }
 
        if (password) {
                encode_wkssvc_join_password_buffer(ctx,
@@ -407,7 +407,7 @@ static WERROR NetGetJoinInformationRemote(struct 
libnetapi_ctx *ctx,
        if (!pipe_cli) {
                werr = ntstatus_to_werror(status);
                goto done;
-       };
+       }
 
        status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, ctx,
                                                      server_name,
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index 953693c..843d579 100644
--- a/source/libads/ldap.c
+++ b/source/libads/ldap.c
@@ -2791,6 +2791,66 @@ ADS_STATUS ads_upn_suffixes(ADS_STRUCT *ads, TALLOC_CTX 
*mem_ctx, char ***suffix
 }
 
 /**
+ * get the joinable ous for a domain
+ * @param ads connection to ads server
+ * @param mem_ctx Pointer to talloc context
+ * @param ous Pointer to an array of ous
+ * @param num_ous Pointer to the number of ous
+ * @return status of search
+ **/
+ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
+                               TALLOC_CTX *mem_ctx,
+                               char ***ous,
+                               size_t *num_ous)
+{
+       ADS_STATUS status;
+       LDAPMessage *res = NULL;
+       LDAPMessage *msg = NULL;
+       const char *attrs[] = { "dn", NULL };
+       int count = 0;
+
+       status = ads_search(ads, &res,
+                           
"(|(objectClass=domain)(objectclass=organizationalUnit))",
+                           attrs);
+       if (!ADS_ERR_OK(status)) {
+               return status;
+       }
+
+       count = ads_count_replies(ads, res);
+       if (count < 1) {
+               ads_msgfree(ads, res);
+               return ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
+       }
+
+       for (msg = ads_first_entry(ads, res); msg;
+            msg = ads_next_entry(ads, msg)) {
+
+               char *dn = NULL;
+
+               dn = ads_get_dn(ads, msg);
+               if (!dn) {
+                       ads_msgfree(ads, res);
+                       return ADS_ERROR(LDAP_NO_MEMORY);
+               }
+
+               if (!add_string_to_array(mem_ctx, dn,
+                                        (const char ***)ous,
+                                        (int *)num_ous)) {
+                       ads_memfree(ads, dn);
+                       ads_msgfree(ads, res);
+                       return ADS_ERROR(LDAP_NO_MEMORY);
+               }
+
+               ads_memfree(ads, dn);
+       }
+
+       ads_msgfree(ads, res);
+
+       return status;
+}
+
+
+/**
  * pull a DOM_SID from an extended dn string
  * @param mem_ctx TALLOC_CTX 
  * @param extended_dn string
diff --git a/source/libnet/libnet_conf.c b/source/libnet/libnet_conf.c
index 6652617..c8e55a7 100644
--- a/source/libnet/libnet_conf.c
+++ b/source/libnet/libnet_conf.c
@@ -68,8 +68,7 @@ static WERROR libnet_conf_reg_initialize(void)
        }
 
        if (!registry_init_regdb()) {
-               /* proper error code? */
-               werr = WERR_GENERAL_FAILURE;
+               werr = WERR_REG_IO_FAILURE;
                goto done;
        }
 
diff --git a/source/libsmb/doserr.c b/source/libsmb/doserr.c
index dd556bb..ba68b5a 100644
--- a/source/libsmb/doserr.c
+++ b/source/libsmb/doserr.c
@@ -63,6 +63,7 @@ werror_code_struct dos_errs[] =
        { "WERR_JOB_NOT_FOUND", WERR_JOB_NOT_FOUND },
        { "WERR_DEST_NOT_FOUND", WERR_DEST_NOT_FOUND },
        { "WERR_NOT_LOCAL_DOMAIN", WERR_NOT_LOCAL_DOMAIN },
+       { "WERR_USER_EXISTS", WERR_USER_EXISTS },
        { "WERR_NO_LOGON_SERVERS", WERR_NO_LOGON_SERVERS },
        { "WERR_NO_SUCH_LOGON_SESSION", WERR_NO_SUCH_LOGON_SESSION },
        { "WERR_PRINTER_DRIVER_IN_USE", WERR_PRINTER_DRIVER_IN_USE },
@@ -77,6 +78,7 @@ werror_code_struct dos_errs[] =
        { "WERR_SETUP_NOT_JOINED", WERR_SETUP_NOT_JOINED },
        { "WERR_SETUP_ALREADY_JOINED", WERR_SETUP_ALREADY_JOINED },
        { "WERR_SETUP_DOMAIN_CONTROLLER", WERR_SETUP_DOMAIN_CONTROLLER },
+       { "WERR_DEFAULT_JOIN_REQUIRED", WERR_DEFAULT_JOIN_REQUIRED },
        { "WERR_DEVICE_NOT_AVAILABLE", WERR_DEVICE_NOT_AVAILABLE },
        { "WERR_LOGON_FAILURE", WERR_LOGON_FAILURE },
        { "WERR_NO_SUCH_DOMAIN", WERR_NO_SUCH_DOMAIN },
@@ -110,6 +112,7 @@ werror_str_struct dos_err_strs[] = {
        { WERR_SETUP_ALREADY_JOINED, "Machine is already joined" },
        { WERR_SETUP_DOMAIN_CONTROLLER, "Machine is a Domain Controller" },
        { WERR_LOGON_FAILURE, "Invalid logon credentials" },
+       { WERR_USER_EXISTS, "User account already exists" },
 };
 
 /*****************************************************************************


-- 
Samba Shared Repository

Reply via email to