Add the PDC end of the smbtorture test for creating an NT_STATUS -> DOS error
authorAndrew Bartlett <abartlet@samba.org>
Sun, 25 Nov 2001 03:01:14 +0000 (03:01 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 25 Nov 2001 03:01:14 +0000 (03:01 +0000)
map.

This little authentication module is #ifdef DEVELOPER, becouse it really is of
no use execept as a development tool

invoke by setting:

auth methods = guest sam name_to_ntstatus

in the smb.conf file (the SAM and guest elements are required for the member
server to authenticate itself).

Andrew Bartlett

source/auth/auth_builtin.c
source/auth/auth_info.c
source/smbd/auth_builtin.c
source/smbd/auth_info.c

index 6ea6d0bbe0bd8b5eca7f0e9c2f4cbe35493bec9a..482ae6dee1684ba142282bcbc151cb22923b4128 100644 (file)
@@ -85,3 +85,36 @@ BOOL auth_init_local(auth_methods **auth_method)
        return True;
 }
 
+/****************************************************************************
+ Return an error based on username
+****************************************************************************/
+
+static NTSTATUS check_name_to_ntstatus_security(void *my_private_data,
+                                               const auth_usersupplied_info *user_info, 
+                                               const auth_authsupplied_info *auth_info,
+                                               auth_serversupplied_info **server_info)
+{
+       NTSTATUS nt_status;
+       fstring user;
+       long error_num;
+       fstrcpy(user, user_info->smb_name.str);
+       strlower(user);
+       error_num = strtoul(user, NULL, 16);
+       
+       DEBUG(5,("Error for user %s was %lx\n", user, error_num));
+
+       nt_status = NT_STATUS(error_num);
+       
+       return nt_status;
+}
+
+BOOL auth_init_name_to_ntstatus(auth_methods **auth_method) 
+{
+       if (!make_auth_methods(auth_method)) {
+               return False;
+       }
+
+       (*auth_method)->auth = check_name_to_ntstatus_security;
+       return True;
+}
+
index 12b843d7818dce528e67543d75ef33fc41c8e64e..b1c994d54f0bd80999b9d10dfcc3033d1e4dcf39 100644 (file)
@@ -31,6 +31,9 @@ const struct auth_init_function builtin_auth_init_functions[] = {
        { "smbserver", auth_init_smbserver },
        { "ntdomain", auth_init_ntdomain },
        { "winbind", auth_init_winbind },
+#ifdef DEVELOPER
+       { "name_to_ntstatus", auth_init_name_to_ntstatus },
+#endif
        { NULL, NULL}
 };
 
index 6ea6d0bbe0bd8b5eca7f0e9c2f4cbe35493bec9a..482ae6dee1684ba142282bcbc151cb22923b4128 100644 (file)
@@ -85,3 +85,36 @@ BOOL auth_init_local(auth_methods **auth_method)
        return True;
 }
 
+/****************************************************************************
+ Return an error based on username
+****************************************************************************/
+
+static NTSTATUS check_name_to_ntstatus_security(void *my_private_data,
+                                               const auth_usersupplied_info *user_info, 
+                                               const auth_authsupplied_info *auth_info,
+                                               auth_serversupplied_info **server_info)
+{
+       NTSTATUS nt_status;
+       fstring user;
+       long error_num;
+       fstrcpy(user, user_info->smb_name.str);
+       strlower(user);
+       error_num = strtoul(user, NULL, 16);
+       
+       DEBUG(5,("Error for user %s was %lx\n", user, error_num));
+
+       nt_status = NT_STATUS(error_num);
+       
+       return nt_status;
+}
+
+BOOL auth_init_name_to_ntstatus(auth_methods **auth_method) 
+{
+       if (!make_auth_methods(auth_method)) {
+               return False;
+       }
+
+       (*auth_method)->auth = check_name_to_ntstatus_security;
+       return True;
+}
+
index 12b843d7818dce528e67543d75ef33fc41c8e64e..b1c994d54f0bd80999b9d10dfcc3033d1e4dcf39 100644 (file)
@@ -31,6 +31,9 @@ const struct auth_init_function builtin_auth_init_functions[] = {
        { "smbserver", auth_init_smbserver },
        { "ntdomain", auth_init_ntdomain },
        { "winbind", auth_init_winbind },
+#ifdef DEVELOPER
+       { "name_to_ntstatus", auth_init_name_to_ntstatus },
+#endif
        { NULL, NULL}
 };