r10377: Save configuration stuff to sconf.cache so it isn't annoyingly run
[Samba.git] / source4 / auth / auth_anonymous.c
blob82aa69c72af9158e9da17f020c9439eaa403d586
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 2 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, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "includes.h"
24 #include "auth/auth.h"
25 #include "librpc/gen_ndr/ndr_samr.h"
26 #include "librpc/gen_ndr/ndr_security.h"
28 /**
29 * Return a anonymous logon for anonymous users (username = "")
31 * Typically used as the first module in the auth chain, this allows
32 * anonymou logons to be dealt with in one place. Non-anonymou logons 'fail'
33 * and pass onto the next module.
34 **/
35 static NTSTATUS anonymous_check_password(struct auth_method_context *ctx,
36 TALLOC_CTX *mem_ctx,
37 const struct auth_usersupplied_info *user_info,
38 struct auth_serversupplied_info **_server_info)
40 if (user_info->client.account_name && *user_info->client.account_name) {
41 return NT_STATUS_NOT_IMPLEMENTED;
44 return auth_anonymous_server_info(mem_ctx, _server_info);
47 static struct auth_operations anonymous_auth_ops = {
48 .name = "anonymous",
49 .get_challenge = auth_get_challenge_not_implemented,
50 .check_password = anonymous_check_password
53 NTSTATUS auth_anonymous_init(void)
55 NTSTATUS ret;
57 ret = auth_register(&anonymous_auth_ops);
58 if (!NT_STATUS_IS_OK(ret)) {
59 DEBUG(0,("Failed to register 'anonymous' auth backend!\n"));
60 return ret;
63 return ret;