2 Unix SMB/CIFS implementation.
3 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 %module(package="samba.credentials") credentials
28 #include "auth/credentials/credentials.h"
29 #include "param/param.h"
30 #include "lib/cmdline/credentials.h"
31 typedef struct cli_credentials cli_credentials;
36 %import "param/param.i"
38 %typemap(default,noblock=1) struct cli_credentials * {
43 #include "librpc/gen_ndr/samr.h" /* for struct samr_Password */
46 %typemap(out,noblock=1) struct samr_Password * {
47 $result = PyString_FromStringAndSize((char *)$1->hash, 16);
50 %talloctype(cli_credentials);
51 %rename(Credentials) cli_credentials;
52 typedef struct cli_credentials {
54 cli_credentials(void) {
55 return cli_credentials_init_anon(NULL);
58 const char *get_username(void);
59 bool set_username(const char *value,
60 enum credentials_obtained=CRED_SPECIFIED);
63 const char *get_password(void);
64 bool set_password(const char *val,
65 enum credentials_obtained=CRED_SPECIFIED);
68 const char *get_domain(void);
69 bool set_domain(const char *val,
70 enum credentials_obtained=CRED_SPECIFIED);
73 const char *get_realm(void);
74 bool set_realm(const char *val,
75 enum credentials_obtained=CRED_SPECIFIED);
77 void parse_string(const char *text,
78 enum credentials_obtained=CRED_SPECIFIED);
81 const char *get_bind_dn(void);
82 bool set_bind_dn(const char *bind_dn);
84 /* workstation name */
85 const char *get_workstation(void);
86 bool set_workstation(const char *workstation,
87 enum credentials_obtained obtained=CRED_SPECIFIED);
89 void guess(struct loadparm_context *lp_ctx);
90 bool is_anonymous(void);
92 const struct samr_Password *get_nt_hash(TALLOC_CTX *mem_ctx);
94 bool authentication_requested(void);
96 bool wrong_password(void);
98 bool set_cmdline_callbacks();
103 struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj)
105 struct cli_credentials *ret;
107 if (py_obj == Py_None) {
108 return cli_credentials_init_anon(NULL);
111 if (SWIG_ConvertPtr(py_obj, (void *)&ret, SWIGTYPE_p_cli_credentials, 0 | 0 ) < 0) {