#include "includes.h"
#include "auth/credentials/credentials.h"
+#include "param/param.h"
+#include "lib/cmdline/credentials.h"
typedef struct cli_credentials cli_credentials;
%}
-%include "carrays.i"
-%include "typemaps.i"
+%import "carrays.i"
+%import "typemaps.i"
+%import "param/param.i"
-%typemap(default) struct cli_credentials * {
+%typemap(default,noblock=1) struct cli_credentials * {
$1 = NULL;
}
+%constant int AUTO_USE_KERBEROS = CRED_AUTO_USE_KERBEROS;
+%constant int DONT_USE_KERBEROS = CRED_DONT_USE_KERBEROS;
+%constant int MUST_USE_KERBEROS = CRED_MUST_USE_KERBEROS;
+
%{
#include "librpc/gen_ndr/samr.h" /* for struct samr_Password */
%}
-%typemap(out) struct samr_Password * {
- $result = PyString_FromStringAndSize($1->hash, 16);
+%typemap(out,noblock=1) struct samr_Password * {
+ $result = PyString_FromStringAndSize((char *)$1->hash, 16);
}
+%talloctype(cli_credentials);
%rename(Credentials) cli_credentials;
typedef struct cli_credentials {
%extend {
- cli_credentials() {
+ cli_credentials(void) {
return cli_credentials_init(NULL);
}
- ~cli_credentials() {
- talloc_free($self);
- }
/* username */
const char *get_username(void);
bool set_username(const char *value,
bool set_realm(const char *val,
enum credentials_obtained=CRED_SPECIFIED);
+ /* Kerberos */
+ void set_kerberos_state(enum credentials_use_kerberos use_kerberos);
+
void parse_string(const char *text,
- enum credentials_obtained=CRED_SPECIFIED);
+ enum credentials_obtained=CRED_SPECIFIED);
/* bind dn */
const char *get_bind_dn(void);
bool set_bind_dn(const char *bind_dn);
+ void set_anonymous();
+
/* workstation name */
const char *get_workstation(void);
bool set_workstation(const char *workstation,
enum credentials_obtained obtained=CRED_SPECIFIED);
- void guess(struct loadparm_context *lp_ctx = NULL);
+ NTSTATUS set_machine_account(struct loadparm_context *lp_ctx);
+
+ void guess(struct loadparm_context *lp_ctx);
bool is_anonymous(void);
const struct samr_Password *get_nt_hash(TALLOC_CTX *mem_ctx);
- bool authentication_requested();
+ bool authentication_requested(void);
- bool wrong_password();
+ bool wrong_password(void);
+
+ bool set_cmdline_callbacks();
}
} cli_credentials;
+
+%{
+struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj)
+{
+ struct cli_credentials *ret;
+
+ if (py_obj == Py_None) {
+ return cli_credentials_init_anon(NULL);
+ }
+
+ if (SWIG_ConvertPtr(py_obj, (void *)&ret, SWIGTYPE_p_cli_credentials, 0 | 0 ) < 0) {
+ return NULL;
+ }
+ return ret;
+}
+
+%}