s4:auth - fixed problem reading bind DN from secrets database
[ira/wip.git] / source4 / auth / credentials / credentials_files.c
index 6c3bb2531eaef6715557e0856bd7933b2226a9ef..42e8ea082ad50d6d8362719fd671363029230bb2 100644 (file)
 #include "librpc/gen_ndr/samr.h" /* for struct samrPassword */
 #include "param/secrets.h"
 #include "system/filesys.h"
-#include "util/util_ldb.h"
+#include "../lib/util/util_ldb.h"
 #include "auth/credentials/credentials.h"
 #include "auth/credentials/credentials_krb5.h"
+#include "auth/credentials/credentials_proto.h"
 #include "param/param.h"
 #include "lib/events/events.h"
 
@@ -118,7 +119,7 @@ _PUBLIC_ bool cli_credentials_parse_file(struct cli_credentials *cred, const cha
        char **lines;
        int i, numlines;
 
-       lines = file_lines_load(file, &numlines, NULL);
+       lines = file_lines_load(file, &numlines, 0, NULL);
 
        if (lines == NULL)
        {
@@ -171,7 +172,7 @@ _PUBLIC_ bool cli_credentials_parse_file(struct cli_credentials *cred, const cha
  * @retval NTSTATUS error detailing any failure
  */
 _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, 
-                                             struct event_context *event_ctx,
+                                             struct tevent_context *event_ctx,
                                     struct loadparm_context *lp_ctx,
                                     struct ldb_context *ldb,
                                     const char *base,
@@ -265,6 +266,9 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
                                cli_credentials_set_anonymous(cred);
                                talloc_free(mem_ctx);
                                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+                       } else {
+                               /* store bind dn in credentials */
+                               cli_credentials_set_bind_dn(cred, ldap_bind_dn);
                        }
                }
        }
@@ -363,7 +367,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr
  * @retval NTSTATUS error detailing any failure
  */
 NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
-                                   struct event_context *event_ctx,
+                                   struct tevent_context *event_ctx,
                                    struct loadparm_context *lp_ctx)
 {
        NTSTATUS status;
@@ -391,7 +395,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
  * @retval NTSTATUS error detailing any failure
  */
 _PUBLIC_ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
-                                                      struct event_context *event_ctx,
+                                                      struct tevent_context *event_ctx,
                                              struct loadparm_context *lp_ctx,
                                              const char *serviceprincipal)
 {