Author: abartlet
Date: 2006-01-03 04:25:12 +0000 (Tue, 03 Jan 2006)
New Revision: 12687

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12687

Log:
Push the real list of supported GENSEC mechanisms out on
supportedSASLMechanism in the rootdse.  (Second half of a patch
commited earlier today).

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/rootdse.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/rootdse.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/rootdse.c  2006-01-03 
00:10:15 UTC (rev 12686)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/rootdse.c  2006-01-03 
04:25:12 UTC (rev 12687)
@@ -24,6 +24,7 @@
 #include "lib/ldb/include/ldb.h"
 #include "lib/ldb/include/ldb_errors.h"
 #include "lib/ldb/include/ldb_private.h"
+#include "auth/gensec/gensec.h"
 #include <time.h>
 
 /*
@@ -43,6 +44,7 @@
 {
        struct ldb_search *s = &req->op.search;
        struct ldb_message *msg;
+       struct cli_credentials *server_creds;
 
        /* this is gross, and will be removed when I change ldb_result not
           to be so pointer crazy :-) */
@@ -61,6 +63,25 @@
                }
        }
 
+       server_creds = talloc_get_type(ldb_get_opaque(module->ldb, 
"server_credentials"), 
+                                      struct cli_credentials);
+       if (do_attribute(s->attrs, "supportedSASLMechanisms")) {
+               const struct gensec_security_ops **ops = 
cli_credentials_gensec_list(server_creds);
+               int i;
+               for (i = 0; ops && ops[i]; i++) {
+                       if (ops[i]->sasl_name) {
+                               const char *sasl_name = talloc_strdup(msg, 
ops[i]->sasl_name);
+                               if (!sasl_name) {
+                                       goto failed;
+                               }
+                               if (ldb_msg_add_string(msg, 
"supportedSASLMechanisms",
+                                                      sasl_name) != 0) {
+                                       goto failed;
+                               }
+                       }
+               }
+       }
+       
        /* TODO: lots more dynamic attributes should be added here */
 
        return 0;

Reply via email to