s3-auth: fix the build of skel auth example module.
authorGünther Deschner <gd@samba.org>
Mon, 17 Oct 2011 13:53:19 +0000 (15:53 +0200)
committerGünther Deschner <gd@samba.org>
Mon, 17 Oct 2011 13:53:19 +0000 (15:53 +0200)
Guenther

examples/auth/auth_skel.c

index e6cbd73968f7e0503627939c773962f3be3040f1..4352251f4ad31bcbca01ac5bdd34a6b234e6ea35 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "includes.h"
+#include "auth.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_AUTH
@@ -26,8 +27,8 @@
 static NTSTATUS check_skel_security(const struct auth_context *auth_context,
                                         void *my_private_data, 
                                         TALLOC_CTX *mem_ctx,
-                                        const auth_usersupplied_info *user_info, 
-                                        auth_serversupplied_info **server_info)
+                                        const struct auth_usersupplied_info *user_info,
+                                        struct auth_serversupplied_info **server_info)
 {
        if (!user_info || !auth_context) {
                return NT_STATUS_LOGON_FAILURE;
@@ -43,12 +44,26 @@ static NTSTATUS check_skel_security(const struct auth_context *auth_context,
 /* module initialisation */
 NTSTATUS auth_init_skel(struct auth_context *auth_context, const char *param, auth_methods **auth_method) 
 {
-       if (!make_auth_methods(auth_context, auth_method)) {
+       struct auth_methods *result;
+
+       result = talloc_zero(auth_context, struct auth_methods);
+       if (result == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
+       result->name = "skel";
+       result->auth = check_skel_security;
+
+       if (param && *param) {
+               /* we load the 'fallback' module - if skel isn't here, call this
+                  module */
+               auth_methods *priv;
+               if (!load_auth_module(auth_context, param, &priv)) {
+                       return NT_STATUS_UNSUCCESSFUL;
+               }
+               result->private_data = (void *)priv;
+       }
 
-       (*auth_method)->auth = check_skel_security;
-       (*auth_method)->name = "skel";
+        *auth_method = result;
        return NT_STATUS_OK;
 }