r21314: add more usefull debug output
[samba.git] / source / auth / auth_developer.c
index 57bda22910940e5521e48b078ec009483f831a6a..f3a984ce30b046efc5fc550fc28b74c8a72a99bc 100644 (file)
 
 #include "includes.h"
 #include "auth/auth.h"
+#include "libcli/security/security.h"
 #include "librpc/gen_ndr/ndr_samr.h"
-#include "librpc/gen_ndr/ndr_security.h"
-#include "pstring.h"
+
+static NTSTATUS name_to_ntstatus_want_check(struct auth_method_context *ctx,
+                                           TALLOC_CTX *mem_ctx,
+                                           const struct auth_usersupplied_info *user_info)
+{
+       return NT_STATUS_OK;
+}
 
 /** 
  * Return an error based on username
@@ -46,9 +52,10 @@ static NTSTATUS name_to_ntstatus_check_password(struct auth_method_context *ctx,
 {
        NTSTATUS nt_status;
        struct auth_serversupplied_info *server_info;
-       fstring user;
        uint32_t error_num;
-       fstrcpy(user, user_info->client.account_name);
+       const char *user;
+
+       user = user_info->client.account_name;
 
        if (strncasecmp("NT_STATUS", user, strlen("NT_STATUS")) == 0) {
                nt_status = nt_status_string_to_code(user);
@@ -57,10 +64,7 @@ static NTSTATUS name_to_ntstatus_check_password(struct auth_method_context *ctx,
                DEBUG(5,("name_to_ntstatus_check_password: Error for user %s was 0x%08X\n", user, error_num));
                nt_status = NT_STATUS(error_num);
        }
-
-       if (!NT_STATUS_IS_OK(nt_status)) {
-               return nt_status;
-       }
+       NT_STATUS_NOT_OK_RETURN(nt_status);
 
        server_info = talloc(mem_ctx, struct auth_serversupplied_info);
        NT_STATUS_HAVE_NO_MEMORY(server_info);
@@ -129,6 +133,7 @@ static NTSTATUS name_to_ntstatus_check_password(struct auth_method_context *ctx,
 static struct auth_operations name_to_ntstatus_auth_ops = {
        .name           = "name_to_ntstatus",
        .get_challenge  = auth_get_challenge_not_implemented,
+       .want_check     = name_to_ntstatus_want_check,
        .check_password = name_to_ntstatus_check_password
 };
 
@@ -158,18 +163,27 @@ static NTSTATUS fixed_challenge_get_challenge(struct auth_method_context *ctx, T
        return NT_STATUS_OK;
 }
 
+static NTSTATUS fixed_challenge_want_check(struct auth_method_context *ctx,
+                                          TALLOC_CTX *mem_ctx,
+                                          const struct auth_usersupplied_info *user_info)
+{
+       /* don't handle any users */
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
 static NTSTATUS fixed_challenge_check_password(struct auth_method_context *ctx,
                                               TALLOC_CTX *mem_ctx,
                                               const struct auth_usersupplied_info *user_info,
                                               struct auth_serversupplied_info **_server_info)
 {
        /* don't handle any users */
-       return NT_STATUS_NOT_IMPLEMENTED;
+       return NT_STATUS_NO_SUCH_USER;
 }
 
 static struct auth_operations fixed_challenge_auth_ops = {
        .name           = "fixed_challenge",
        .get_challenge  = fixed_challenge_get_challenge,
+       .want_check     = fixed_challenge_want_check,
        .check_password = fixed_challenge_check_password
 };