s3-shadow-copy2: Add more debugs
[Samba.git] / source4 / auth / ntlm / auth_anonymous.c
blob28cbfe831ef125d91025b805fbd897848d51f114
1 /*
2 Unix SMB/CIFS implementation.
4 Anonymous Authentification
6 Copyright (C) Stefan Metzmacher 2004-2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "auth/auth.h"
24 #include "auth/ntlm/auth_proto.h"
25 #include "param/param.h"
27 _PUBLIC_ NTSTATUS auth4_anonymous_init(void);
29 /**
30 * Return a anonymous logon for anonymous users (username = "")
32 * Typically used as the first module in the auth chain, this allows
33 * anonymou logons to be dealt with in one place. Non-anonymou logons 'fail'
34 * and pass onto the next module.
35 **/
36 static NTSTATUS anonymous_want_check(struct auth_method_context *ctx,
37 TALLOC_CTX *mem_ctx,
38 const struct auth_usersupplied_info *user_info)
40 if (user_info->client.account_name && *user_info->client.account_name) {
41 return NT_STATUS_NOT_IMPLEMENTED;
44 return NT_STATUS_OK;
47 /**
48 * Return a anonymous logon for anonymous users (username = "")
50 * Typically used as the first module in the auth chain, this allows
51 * anonymou logons to be dealt with in one place. Non-anonymou logons 'fail'
52 * and pass onto the next module.
53 **/
54 static NTSTATUS anonymous_check_password(struct auth_method_context *ctx,
55 TALLOC_CTX *mem_ctx,
56 const struct auth_usersupplied_info *user_info,
57 struct auth_user_info_dc **_user_info_dc)
59 return auth_anonymous_user_info_dc(mem_ctx, lpcfg_netbios_name(ctx->auth_ctx->lp_ctx), _user_info_dc);
62 static const struct auth_operations anonymous_auth_ops = {
63 .name = "anonymous",
64 .want_check = anonymous_want_check,
65 .check_password = anonymous_check_password
68 _PUBLIC_ NTSTATUS auth4_anonymous_init(void)
70 NTSTATUS ret;
72 ret = auth_register(&anonymous_auth_ops);
73 if (!NT_STATUS_IS_OK(ret)) {
74 DEBUG(0,("Failed to register 'anonymous' auth backend!\n"));
75 return ret;
78 return ret;