1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3

Conflicts:

	source/Makefile
	source/auth/config.mk
	source/auth/gensec/config.mk
	source/build/m4/public.m4
	source/build/make/python.mk
	source/build/make/rules.mk
	source/build/smb_build/header.pm
	source/build/smb_build/main.pl
	source/build/smb_build/makefile.pm
	source/dsdb/config.mk
	source/dsdb/samdb/ldb_modules/config.mk
	source/kdc/config.mk
	source/lib/events/config.mk
	source/lib/events/events.c
	source/lib/ldb/config.mk
	source/lib/nss_wrapper/config.mk
	source/lib/policy/config.mk
	source/lib/util/config.mk
	source/libcli/smb2/config.mk
	source/libnet/config.mk
	source/librpc/config.mk
	source/nbt_server/config.mk
	source/ntptr/ntptr_base.c
	source/ntvfs/posix/config.mk
	source/ntvfs/sysdep/config.mk
	source/param/config.mk
	source/rpc_server/config.mk
	source/rpc_server/service_rpc.c
	source/scripting/ejs/config.mk
	source/scripting/python/config.mk
	source/smb_server/config.mk
	source/smbd/server.c
	source/torture/config.mk
	source/torture/smb2/config.mk
	source/wrepl_server/config.mk
This commit is contained in:
Jelmer Vernooij 2008-04-25 10:04:20 +01:00
commit 13bbd42068
361 changed files with 6347 additions and 12399 deletions

View File

@ -24,7 +24,7 @@ $(srcdir)/version.h: $(srcdir)/VERSION
.DEFAULT_GOAL := all
ifneq ($(automatic_deps),yes)
ifneq ($(automatic_dependencies),yes)
ALL_PREDEP = proto
.NOTPARALLEL:
endif
@ -51,6 +51,8 @@ include data.mk
BINARIES += $(BIN_PROGS) $(SBIN_PROGS)
pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
include/includes.d

View File

@ -289,7 +289,7 @@ static NTSTATUS authsam_check_password_internals(struct auth_method_context *ctx
return NT_STATUS_NO_MEMORY;
}
sam_ctx = samdb_connect(tmp_ctx, ctx->auth_ctx->lp_ctx, system_session(mem_ctx, ctx->auth_ctx->lp_ctx));
sam_ctx = samdb_connect(tmp_ctx, ctx->auth_ctx->event_ctx, ctx->auth_ctx->lp_ctx, system_session(mem_ctx, ctx->auth_ctx->lp_ctx));
if (sam_ctx == NULL) {
talloc_free(tmp_ctx);
return NT_STATUS_INVALID_SYSTEM_SERVICE;

View File

@ -90,7 +90,7 @@ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
}
if (session_info) {
nt_status = auth_generate_session_info(tmp_ctx, lp_ctx, server_info, session_info);
nt_status = auth_generate_session_info(tmp_ctx, ev, lp_ctx, server_info, session_info);
if (NT_STATUS_IS_OK(nt_status)) {
talloc_steal(mem_ctx, *session_info);

View File

@ -87,13 +87,13 @@ PRIVATE_PROTO_HEADER = pam_errors.h
PAM_ERRORS_OBJ_FILES = $(addprefix auth/, pam_errors.o)
[MODULE::service_auth]
[MODULE::auth]
INIT_FUNCTION = server_service_auth_init
SUBSYSTEM = smbd
PRIVATE_PROTO_HEADER = auth_proto.h
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSECURITY SAMDB CREDENTIALS
service_auth_OBJ_FILES = $(addprefix auth/, auth.o auth_util.o auth_simple.o)
auth_OBJ_FILES = $(addprefix auth/, auth.o auth_util.o auth_simple.o)
# PUBLIC_HEADERS += auth/auth.h

View File

@ -65,7 +65,6 @@ _PUBLIC_ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx)
cred->tries = 3;
cred->callback_running = false;
cred->ev = NULL;
cli_credentials_set_kerberos_state(cred, CRED_AUTO_USE_KERBEROS);
cli_credentials_set_gensec_features(cred, 0);
@ -675,7 +674,7 @@ _PUBLIC_ void cli_credentials_guess(struct cli_credentials *cred,
}
if (cli_credentials_get_kerberos_state(cred) != CRED_DONT_USE_KERBEROS) {
cli_credentials_set_ccache(cred, lp_ctx, NULL, CRED_GUESS_FILE);
cli_credentials_set_ccache(cred, event_context_find(cred), lp_ctx, NULL, CRED_GUESS_FILE);
}
}
@ -775,22 +774,3 @@ _PUBLIC_ bool cli_credentials_wrong_password(struct cli_credentials *cred)
return (cred->tries > 0);
}
/*
set the common event context for this set of credentials
*/
_PUBLIC_ void cli_credentials_set_event_context(struct cli_credentials *cred, struct event_context *ev)
{
cred->ev = ev;
}
/*
set the common event context for this set of credentials
*/
_PUBLIC_ struct event_context *cli_credentials_get_event_context(struct cli_credentials *cred)
{
if (cred->ev == NULL) {
cred->ev = event_context_find(cred);
}
return cred->ev;
}

View File

@ -26,6 +26,7 @@
#include "librpc/gen_ndr/misc.h"
struct ccache_container;
struct event_context;
/* In order of priority */
enum credentials_obtained {
@ -121,9 +122,6 @@ struct cli_credentials {
/* Whether any callback is currently running */
bool callback_running;
/* an event context for anyone wanting to use the credentials */
struct event_context *ev;
};
struct ldb_context;
@ -152,12 +150,15 @@ NTSTATUS cli_credentials_get_ntlm_response(struct cli_credentials *cred, TALLOC_
const char *cli_credentials_get_realm(struct cli_credentials *cred);
const char *cli_credentials_get_username(struct cli_credentials *cred);
int cli_credentials_get_krb5_context(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct smb_krb5_context **smb_krb5_context);
int cli_credentials_get_ccache(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ccache_container **ccc);
int cli_credentials_get_keytab(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct keytab_container **_ktc);
const char *cli_credentials_get_domain(struct cli_credentials *cred);
@ -168,15 +169,15 @@ void cli_credentials_set_conf(struct cli_credentials *cred,
struct loadparm_context *lp_ctx);
const char *cli_credentials_get_principal(struct cli_credentials *cred, TALLOC_CTX *mem_ctx);
int cli_credentials_get_server_gss_creds(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct gssapi_creds_container **_gcc);
int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct gssapi_creds_container **_gcc);
void cli_credentials_set_event_context(struct cli_credentials *cred, struct event_context *ev);
void cli_credentials_set_kerberos_state(struct cli_credentials *creds,
enum credentials_use_kerberos use_kerberos);
struct event_context *cli_credentials_get_event_context(struct cli_credentials *cred);
bool cli_credentials_set_domain(struct cli_credentials *cred,
const char *val,
enum credentials_obtained obtained);
@ -199,6 +200,7 @@ void cli_credentials_set_netlogon_creds(struct cli_credentials *cred,
NTSTATUS cli_credentials_set_krb5_context(struct cli_credentials *cred,
struct smb_krb5_context *smb_krb5_context);
NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *serviceprincipal);
NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cred,
@ -220,14 +222,17 @@ bool cli_credentials_set_nt_hash(struct cli_credentials *cred,
const struct samr_Password *nt_hash,
enum credentials_obtained obtained);
int cli_credentials_set_keytab_name(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *keytab_name,
enum credentials_obtained obtained);
int cli_credentials_update_keytab(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx);
void cli_credentials_set_gensec_features(struct cli_credentials *creds, uint32_t gensec_features);
uint32_t cli_credentials_get_gensec_features(struct cli_credentials *creds);
int cli_credentials_set_ccache(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *name,
enum credentials_obtained obtained);
@ -239,6 +244,7 @@ void cli_credentials_invalidate_ccache(struct cli_credentials *cred,
void cli_credentials_set_salt_principal(struct cli_credentials *cred, const char *principal);
enum credentials_use_kerberos cli_credentials_get_kerberos_state(struct cli_credentials *creds);
NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ldb_context *ldb,
const char *base,

View File

@ -95,6 +95,8 @@ typedef struct cli_credentials {
bool set_workstation(const char *workstation,
enum credentials_obtained obtained=CRED_SPECIFIED);
NTSTATUS set_machine_account(struct loadparm_context *lp_ctx);
void guess(struct loadparm_context *lp_ctx);
bool is_anonymous(void);

View File

@ -82,6 +82,7 @@ Credentials.set_bind_dn = new_instancemethod(_credentials.Credentials_set_bind_d
Credentials.set_anonymous = new_instancemethod(_credentials.Credentials_set_anonymous,None,Credentials)
Credentials.get_workstation = new_instancemethod(_credentials.Credentials_get_workstation,None,Credentials)
Credentials.set_workstation = new_instancemethod(_credentials.Credentials_set_workstation,None,Credentials)
Credentials.set_machine_account = new_instancemethod(_credentials.Credentials_set_machine_account,None,Credentials)
Credentials.guess = new_instancemethod(_credentials.Credentials_guess,None,Credentials)
Credentials.is_anonymous = new_instancemethod(_credentials.Credentials_is_anonymous,None,Credentials)
Credentials.get_nt_hash = new_instancemethod(_credentials.Credentials_get_nt_hash,None,Credentials)

View File

@ -30,6 +30,7 @@
#include "auth/credentials/credentials.h"
#include "auth/credentials/credentials_krb5.h"
#include "param/param.h"
#include "lib/events/events.h"
/**
* Read a file descriptor, and parse it for a password (eg from a file or stdin)
@ -169,6 +170,7 @@ _PUBLIC_ bool cli_credentials_parse_file(struct cli_credentials *cred, const cha
* @retval NTSTATUS error detailing any failure
*/
_PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ldb_context *ldb,
const char *base,
@ -305,13 +307,13 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
* (chewing CPU time) from the password */
keytab = ldb_msg_find_attr_as_string(msgs[0], "krb5Keytab", NULL);
if (keytab) {
cli_credentials_set_keytab_name(cred, lp_ctx, keytab, CRED_SPECIFIED);
cli_credentials_set_keytab_name(cred, event_ctx, lp_ctx, keytab, CRED_SPECIFIED);
} else {
keytab = ldb_msg_find_attr_as_string(msgs[0], "privateKeytab", NULL);
if (keytab) {
keytab = talloc_asprintf(mem_ctx, "FILE:%s", private_path(mem_ctx, lp_ctx, keytab));
if (keytab) {
cli_credentials_set_keytab_name(cred, lp_ctx, keytab, CRED_SPECIFIED);
cli_credentials_set_keytab_name(cred, event_ctx, lp_ctx, keytab, CRED_SPECIFIED);
}
}
}
@ -327,7 +329,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
* @retval NTSTATUS error detailing any failure
*/
_PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cred,
struct loadparm_context *lp_ctx)
struct loadparm_context *lp_ctx)
{
char *filter;
/* Bleh, nasty recursion issues: We are setting a machine
@ -336,7 +338,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr
cred->machine_account_pending = false;
filter = talloc_asprintf(cred, SECRETS_PRIMARY_DOMAIN_FILTER,
cli_credentials_get_domain(cred));
return cli_credentials_set_secrets(cred, lp_ctx, NULL,
return cli_credentials_set_secrets(cred, event_context_find(cred), lp_ctx, NULL,
SECRETS_PRIMARY_DOMAIN_DN,
filter);
}
@ -348,6 +350,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr
* @retval NTSTATUS error detailing any failure
*/
NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx)
{
char *filter;
@ -358,7 +361,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
filter = talloc_asprintf(cred, SECRETS_KRBTGT_SEARCH,
cli_credentials_get_realm(cred),
cli_credentials_get_domain(cred));
return cli_credentials_set_secrets(cred, lp_ctx, NULL,
return cli_credentials_set_secrets(cred, event_ctx, lp_ctx, NULL,
SECRETS_PRINCIPALS_DN,
filter);
}
@ -370,6 +373,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
* @retval NTSTATUS error detailing any failure
*/
_PUBLIC_ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *serviceprincipal)
{
@ -382,7 +386,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *c
cli_credentials_get_realm(cred),
cli_credentials_get_domain(cred),
serviceprincipal);
return cli_credentials_set_secrets(cred, lp_ctx, NULL,
return cli_credentials_set_secrets(cred, event_ctx, lp_ctx, NULL,
SECRETS_PRINCIPALS_DN, filter);
}

View File

@ -30,6 +30,7 @@
#include "param/param.h"
_PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct smb_krb5_context **smb_krb5_context)
{
@ -39,8 +40,7 @@ _PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred,
return 0;
}
ret = smb_krb5_init_context(cred, cli_credentials_get_event_context(cred),
lp_ctx, &cred->smb_krb5_context);
ret = smb_krb5_init_context(cred, event_ctx, lp_ctx, &cred->smb_krb5_context);
if (ret) {
cred->smb_krb5_context = NULL;
return ret;
@ -128,6 +128,7 @@ static int free_dccache(struct ccache_container *ccc) {
}
_PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *name,
enum credentials_obtained obtained)
@ -144,7 +145,7 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred,
return ENOMEM;
}
ret = cli_credentials_get_krb5_context(cred, lp_ctx,
ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx,
&ccc->smb_krb5_context);
if (ret) {
talloc_free(ccc);
@ -203,6 +204,7 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred,
static int cli_credentials_new_ccache(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ccache_container **_ccc)
{
@ -221,7 +223,7 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred,
return ENOMEM;
}
ret = cli_credentials_get_krb5_context(cred, lp_ctx,
ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx,
&ccc->smb_krb5_context);
if (ret) {
talloc_free(ccc);
@ -253,6 +255,7 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred,
}
_PUBLIC_ int cli_credentials_get_ccache(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct ccache_container **ccc)
{
@ -271,7 +274,7 @@ _PUBLIC_ int cli_credentials_get_ccache(struct cli_credentials *cred,
return EINVAL;
}
ret = cli_credentials_new_ccache(cred, lp_ctx, ccc);
ret = cli_credentials_new_ccache(cred, event_ctx, lp_ctx, ccc);
if (ret) {
return ret;
}
@ -348,6 +351,7 @@ static int free_gssapi_creds(struct gssapi_creds_container *gcc)
}
_PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct gssapi_creds_container **_gcc)
{
@ -360,7 +364,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
*_gcc = cred->client_gss_creds;
return 0;
}
ret = cli_credentials_get_ccache(cred, lp_ctx,
ret = cli_credentials_get_ccache(cred, event_ctx, lp_ctx,
&ccache);
if (ret) {
DEBUG(1, ("Failed to get CCACHE for GSSAPI client: %s\n", error_message(ret)));
@ -402,6 +406,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
*/
int cli_credentials_set_client_gss_creds(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
gss_cred_id_t gssapi_cred,
enum credentials_obtained obtained)
@ -419,7 +424,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
return ENOMEM;
}
ret = cli_credentials_new_ccache(cred, lp_ctx, &ccc);
ret = cli_credentials_new_ccache(cred, event_ctx, lp_ctx, &ccc);
if (ret != 0) {
return ret;
}
@ -456,6 +461,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
* it will be generated from the password.
*/
_PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct keytab_container **_ktc)
{
@ -475,7 +481,7 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
return EINVAL;
}
ret = cli_credentials_get_krb5_context(cred, lp_ctx,
ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx,
&smb_krb5_context);
if (ret) {
return ret;
@ -510,6 +516,7 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
* FILE:/etc/krb5.keytab), open it and attach it */
_PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *keytab_name,
enum credentials_obtained obtained)
@ -523,7 +530,7 @@ _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred,
return 0;
}
ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context);
ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context);
if (ret) {
return ret;
}
@ -549,6 +556,7 @@ _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred,
}
_PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx)
{
krb5_error_code ret;
@ -562,7 +570,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
return ENOMEM;
}
ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context);
ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context);
if (ret) {
talloc_free(mem_ctx);
return ret;
@ -570,7 +578,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
enctype_strings = cli_credentials_get_enctype_strings(cred);
ret = cli_credentials_get_keytab(cred, lp_ctx, &ktc);
ret = cli_credentials_get_keytab(cred, event_ctx, lp_ctx, &ktc);
if (ret != 0) {
talloc_free(mem_ctx);
return ret;
@ -585,6 +593,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
/* Get server gss credentials (in gsskrb5, this means the keytab) */
_PUBLIC_ int cli_credentials_get_server_gss_creds(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct gssapi_creds_container **_gcc)
{
@ -603,12 +612,12 @@ _PUBLIC_ int cli_credentials_get_server_gss_creds(struct cli_credentials *cred,
return 0;
}
ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context);
ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context);
if (ret) {
return ret;
}
ret = cli_credentials_get_keytab(cred, lp_ctx, &ktc);
ret = cli_credentials_get_keytab(cred, event_ctx, lp_ctx, &ktc);
if (ret) {
DEBUG(1, ("Failed to get keytab for GSSAPI server: %s\n", error_message(ret)));
return ret;

View File

@ -32,6 +32,7 @@ struct gssapi_creds_container {
/* Manually prototyped here to avoid needing gss headers in most callers */
int cli_credentials_set_client_gss_creds(struct cli_credentials *cred,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
gss_cred_id_t gssapi_cred,
enum credentials_obtained obtained);

View File

@ -2456,24 +2456,25 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
/* -------- TYPES TABLE (BEGIN) -------- */
#define SWIGTYPE_p_TALLOC_CTX swig_types[0]
#define SWIGTYPE_p_char swig_types[1]
#define SWIGTYPE_p_cli_credentials swig_types[2]
#define SWIGTYPE_p_int swig_types[3]
#define SWIGTYPE_p_loadparm_context swig_types[4]
#define SWIGTYPE_p_loadparm_service swig_types[5]
#define SWIGTYPE_p_long swig_types[6]
#define SWIGTYPE_p_param_context swig_types[7]
#define SWIGTYPE_p_param_opt swig_types[8]
#define SWIGTYPE_p_param_section swig_types[9]
#define SWIGTYPE_p_short swig_types[10]
#define SWIGTYPE_p_signed_char swig_types[11]
#define SWIGTYPE_p_unsigned_char swig_types[12]
#define SWIGTYPE_p_unsigned_int swig_types[13]
#define SWIGTYPE_p_unsigned_long swig_types[14]
#define SWIGTYPE_p_unsigned_short swig_types[15]
static swig_type_info *swig_types[17];
static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
#define SWIGTYPE_p_NTSTATUS swig_types[0]
#define SWIGTYPE_p_TALLOC_CTX swig_types[1]
#define SWIGTYPE_p_char swig_types[2]
#define SWIGTYPE_p_cli_credentials swig_types[3]
#define SWIGTYPE_p_int swig_types[4]
#define SWIGTYPE_p_loadparm_context swig_types[5]
#define SWIGTYPE_p_loadparm_service swig_types[6]
#define SWIGTYPE_p_long_long swig_types[7]
#define SWIGTYPE_p_param_context swig_types[8]
#define SWIGTYPE_p_param_opt swig_types[9]
#define SWIGTYPE_p_param_section swig_types[10]
#define SWIGTYPE_p_short swig_types[11]
#define SWIGTYPE_p_signed_char swig_types[12]
#define SWIGTYPE_p_unsigned_char swig_types[13]
#define SWIGTYPE_p_unsigned_int swig_types[14]
#define SWIGTYPE_p_unsigned_long_long swig_types[15]
#define SWIGTYPE_p_unsigned_short swig_types[16]
static swig_type_info *swig_types[18];
static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -3409,6 +3410,46 @@ fail:
}
SWIGINTERN PyObject *_wrap_Credentials_set_machine_account(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
cli_credentials *arg1 = (cli_credentials *) 0 ;
struct loadparm_context *arg2 = (struct loadparm_context *) 0 ;
NTSTATUS result;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char * kwnames[] = {
(char *) "self",(char *) "lp_ctx", NULL
};
arg1 = NULL;
arg2 = loadparm_init(NULL);
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_set_machine_account",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_machine_account" "', argument " "1"" of type '" "cli_credentials *""'");
}
arg1 = (cli_credentials *)(argp1);
}
if (obj1) {
res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_context, 0 | 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_machine_account" "', argument " "2"" of type '" "struct loadparm_context *""'");
}
arg2 = (struct loadparm_context *)(argp2);
}
result = cli_credentials_set_machine_account(arg1,arg2);
resultobj = SWIG_NewPointerObj((NTSTATUS *)memcpy((NTSTATUS *)malloc(sizeof(NTSTATUS)),&result,sizeof(NTSTATUS)), SWIGTYPE_p_NTSTATUS, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
PyObject *resultobj = 0;
cli_credentials *arg1 = (cli_credentials *) 0 ;
@ -3646,6 +3687,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"Credentials_set_anonymous", (PyCFunction) _wrap_Credentials_set_anonymous, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_get_workstation", (PyCFunction) _wrap_Credentials_get_workstation, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_set_workstation", (PyCFunction) _wrap_Credentials_set_workstation, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_set_machine_account", (PyCFunction) _wrap_Credentials_set_machine_account, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_guess", (PyCFunction) _wrap_Credentials_guess, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_is_anonymous", (PyCFunction) _wrap_Credentials_is_anonymous, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Credentials_get_nt_hash", (PyCFunction) _wrap_Credentials_get_nt_hash, METH_VARARGS | METH_KEYWORDS, NULL},
@ -3661,31 +3703,33 @@ static PyMethodDef SwigMethods[] = {
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
static swig_type_info _swigt__p_NTSTATUS = {"_p_NTSTATUS", "NTSTATUS *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *|int_least32_t *|int32_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_loadparm_service = {"_p_loadparm_service", "struct loadparm_service *|loadparm_service *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_long = {"_p_long", "intptr_t *|int_least64_t *|int_fast32_t *|int_fast64_t *|int64_t *|long *|int_fast16_t *|intmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_opt = {"_p_param_opt", "struct param_opt *|param_opt *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uint_least32_t *|uint32_t *|unsigned int *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "uintptr_t *|uint_least64_t *|uint_fast32_t *|uint_fast64_t *|uint64_t *|unsigned long *|uint_fast16_t *|uintmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
static swig_type_info *swig_type_initial[] = {
&_swigt__p_NTSTATUS,
&_swigt__p_TALLOC_CTX,
&_swigt__p_char,
&_swigt__p_cli_credentials,
&_swigt__p_int,
&_swigt__p_loadparm_context,
&_swigt__p_loadparm_service,
&_swigt__p_long,
&_swigt__p_long_long,
&_swigt__p_param_context,
&_swigt__p_param_opt,
&_swigt__p_param_section,
@ -3693,17 +3737,18 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_signed_char,
&_swigt__p_unsigned_char,
&_swigt__p_unsigned_int,
&_swigt__p_unsigned_long,
&_swigt__p_unsigned_long_long,
&_swigt__p_unsigned_short,
};
static swig_cast_info _swigc__p_NTSTATUS[] = { {&_swigt__p_NTSTATUS, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_cli_credentials[] = { {&_swigt__p_cli_credentials, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_loadparm_context[] = { {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_loadparm_service[] = { {&_swigt__p_loadparm_service, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_long[] = { {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_context[] = { {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_opt[] = { {&_swigt__p_param_opt, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_param_section[] = { {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}};
@ -3711,17 +3756,18 @@ static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0,
static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_long[] = { {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info *swig_cast_initial[] = {
_swigc__p_NTSTATUS,
_swigc__p_TALLOC_CTX,
_swigc__p_char,
_swigc__p_cli_credentials,
_swigc__p_int,
_swigc__p_loadparm_context,
_swigc__p_loadparm_service,
_swigc__p_long,
_swigc__p_long_long,
_swigc__p_param_context,
_swigc__p_param_opt,
_swigc__p_param_section,
@ -3729,7 +3775,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_signed_char,
_swigc__p_unsigned_char,
_swigc__p_unsigned_int,
_swigc__p_unsigned_long,
_swigc__p_unsigned_long_long,
_swigc__p_unsigned_short,
};

View File

@ -481,6 +481,11 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
struct messaging_context *msg,
struct gensec_security **gensec_security)
{
if (ev == NULL) {
DEBUG(0, ("No event context available!\n"));
return NT_STATUS_INTERNAL_ERROR;
}
(*gensec_security) = talloc(mem_ctx, struct gensec_security);
NT_STATUS_HAVE_NO_MEMORY(*gensec_security);
@ -492,14 +497,6 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
(*gensec_security)->subcontext = false;
(*gensec_security)->want_features = 0;
if (ev == NULL) {
ev = event_context_init(*gensec_security);
if (ev == NULL) {
talloc_free(*gensec_security);
return NT_STATUS_NO_MEMORY;
}
}
(*gensec_security)->event_ctx = ev;
(*gensec_security)->msg_ctx = msg;
@ -547,20 +544,11 @@ _PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx)
{
NTSTATUS status;
struct event_context *new_ev = NULL;
if (ev == NULL) {
new_ev = event_context_init(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY(new_ev);
ev = new_ev;
}
status = gensec_start(mem_ctx, ev, lp_ctx, NULL, gensec_security);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(new_ev);
return status;
}
talloc_steal((*gensec_security), new_ev);
(*gensec_security)->gensec_role = GENSEC_CLIENT;
return status;

View File

@ -273,7 +273,9 @@ static NTSTATUS gensec_gssapi_server_start(struct gensec_security *gensec_securi
DEBUG(3, ("No machine account credentials specified\n"));
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
} else {
ret = cli_credentials_get_server_gss_creds(machine_account, gensec_security->lp_ctx, &gcc);
ret = cli_credentials_get_server_gss_creds(machine_account,
gensec_security->event_ctx,
gensec_security->lp_ctx, &gcc);
if (ret) {
DEBUG(1, ("Aquiring acceptor credentials failed: %s\n",
error_message(ret)));
@ -359,7 +361,9 @@ static NTSTATUS gensec_gssapi_client_start(struct gensec_security *gensec_securi
return NT_STATUS_INVALID_PARAMETER;
}
ret = cli_credentials_get_client_gss_creds(creds, gensec_security->lp_ctx, &gcc);
ret = cli_credentials_get_client_gss_creds(creds,
gensec_security->event_ctx,
gensec_security->lp_ctx, &gcc);
switch (ret) {
case 0:
break;
@ -1323,7 +1327,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
} else if (!lp_parm_bool(gensec_security->lp_ctx, NULL, "gensec", "require_pac", false)) {
DEBUG(1, ("Unable to find PAC, resorting to local user lookup: %s\n",
gssapi_error_string(mem_ctx, maj_stat, min_stat, gensec_gssapi_state->gss_oid)));
nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->lp_ctx, principal_string,
nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, principal_string,
&server_info);
if (!NT_STATUS_IS_OK(nt_status)) {
@ -1338,7 +1342,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
}
/* references the server_info into the session_info */
nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
nt_status = auth_generate_session_info(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, server_info, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
talloc_free(mem_ctx);
return nt_status;
@ -1361,12 +1365,12 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
return NT_STATUS_NO_MEMORY;
}
cli_credentials_set_event_context(session_info->credentials, gensec_security->event_ctx);
cli_credentials_set_conf(session_info->credentials, gensec_security->lp_ctx);
/* Just so we don't segfault trying to get at a username */
cli_credentials_set_anonymous(session_info->credentials);
ret = cli_credentials_set_client_gss_creds(session_info->credentials,
gensec_security->event_ctx,
gensec_security->lp_ctx,
gensec_gssapi_state->delegated_cred_handle,
CRED_SPECIFIED);

View File

@ -118,7 +118,9 @@ static NTSTATUS gensec_krb5_start(struct gensec_security *gensec_security)
talloc_set_destructor(gensec_krb5_state, gensec_krb5_destroy);
if (cli_credentials_get_krb5_context(creds, gensec_security->lp_ctx, &gensec_krb5_state->smb_krb5_context)) {
if (cli_credentials_get_krb5_context(creds,
gensec_security->event_ctx,
gensec_security->lp_ctx, &gensec_krb5_state->smb_krb5_context)) {
talloc_free(gensec_krb5_state);
return NT_STATUS_INTERNAL_ERROR;
}
@ -248,7 +250,9 @@ static NTSTATUS gensec_krb5_client_start(struct gensec_security *gensec_security
principal = gensec_get_target_principal(gensec_security);
ret = cli_credentials_get_ccache(gensec_get_credentials(gensec_security), gensec_security->lp_ctx, &ccache_container);
ret = cli_credentials_get_ccache(gensec_get_credentials(gensec_security),
gensec_security->event_ctx,
gensec_security->lp_ctx, &ccache_container);
switch (ret) {
case 0:
break;
@ -446,7 +450,9 @@ static NTSTATUS gensec_krb5_update(struct gensec_security *gensec_security,
}
/* Grab the keytab, however generated */
ret = cli_credentials_get_keytab(gensec_get_credentials(gensec_security), gensec_security->lp_ctx, &keytab);
ret = cli_credentials_get_keytab(gensec_get_credentials(gensec_security),
gensec_security->event_ctx,
gensec_security->lp_ctx, &keytab);
if (ret) {
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
}
@ -597,7 +603,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security
DEBUG(5, ("krb5_ticket_get_authorization_data_type failed to find PAC: %s\n",
smb_get_krb5_error_message(context,
ret, mem_ctx)));
nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->lp_ctx, principal_string,
nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, principal_string,
&server_info);
krb5_free_principal(context, client_principal);
free(principal_string);
@ -645,7 +651,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security
}
/* references the server_info into the session_info */
nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
nt_status = auth_generate_session_info(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, server_info, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
talloc_free(mem_ctx);

View File

@ -125,7 +125,8 @@ static NTSTATUS schannel_update(struct gensec_security *gensec_security, TALLOC_
}
/* pull the session key for this client */
status = schannel_fetch_session_key(out_mem_ctx, gensec_security->lp_ctx, workstation,
status = schannel_fetch_session_key(out_mem_ctx, gensec_security->event_ctx,
gensec_security->lp_ctx, workstation,
domain, &creds);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(3, ("Could not find session key for attempted schannel connection from %s: %s\n",
@ -189,7 +190,7 @@ static NTSTATUS schannel_session_info(struct gensec_security *gensec_security,
struct auth_session_info **_session_info)
{
struct schannel_state *state = talloc_get_type(gensec_security->private_data, struct schannel_state);
return auth_anonymous_session_info(state, gensec_security->lp_ctx, _session_info);
return auth_anonymous_session_info(state, gensec_security->event_ctx, gensec_security->lp_ctx, _session_info);
}
static NTSTATUS schannel_start(struct gensec_security *gensec_security)

View File

@ -32,7 +32,8 @@
/**
connect to the schannel ldb
*/
struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx,
struct loadparm_context *lp_ctx)
{
char *path;
struct ldb_context *ldb;
@ -49,7 +50,7 @@ struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_con
existed = file_exist(path);
ldb = ldb_wrap_connect(mem_ctx, lp_ctx, path,
ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, path,
system_session(mem_ctx, lp_ctx),
NULL, LDB_FLG_NOSYNC, NULL);
talloc_free(path);
@ -137,6 +138,7 @@ NTSTATUS schannel_store_session_key_ldb(TALLOC_CTX *mem_ctx,
}
NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct creds_CredentialState *creds)
{
@ -144,7 +146,7 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
NTSTATUS nt_status;
int ret;
ldb = schannel_db_connect(mem_ctx, lp_ctx);
ldb = schannel_db_connect(mem_ctx, ev_ctx, lp_ctx);
if (!ldb) {
return NT_STATUS_ACCESS_DENIED;
}
@ -268,6 +270,7 @@ NTSTATUS schannel_fetch_session_key_ldb(TALLOC_CTX *mem_ctx,
}
NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
const char *computer_name,
const char *domain,
@ -276,7 +279,7 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
NTSTATUS nt_status;
struct ldb_context *ldb;
ldb = schannel_db_connect(mem_ctx, lp_ctx);
ldb = schannel_db_connect(mem_ctx, ev_ctx, lp_ctx);
if (!ldb) {
return NT_STATUS_ACCESS_DENIED;
}

View File

@ -725,7 +725,7 @@ NTSTATUS gensec_ntlmssp_session_info(struct gensec_security *gensec_security,
NTSTATUS nt_status;
struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info);
nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->event_ctx, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info);
NT_STATUS_NOT_OK_RETURN(nt_status);
(*session_info)->session_key = data_blob_talloc(*session_info,

View File

@ -428,6 +428,7 @@ NTSTATUS sam_get_results_principal(struct ldb_context *sam_ctx,
/* Used in the gensec_gssapi and gensec_krb5 server-side code, where the PAC isn't available */
NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
const char *principal,
struct auth_serversupplied_info **server_info)
@ -445,7 +446,7 @@ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
sam_ctx = samdb_connect(tmp_ctx, lp_ctx, system_session(tmp_ctx, lp_ctx));
sam_ctx = samdb_connect(tmp_ctx, event_ctx, lp_ctx, system_session(tmp_ctx, lp_ctx));
if (sam_ctx == NULL) {
talloc_free(tmp_ctx);
return NT_STATUS_INVALID_SYSTEM_SERVICE;

View File

@ -31,11 +31,12 @@
#include "auth/session_proto.h"
_PUBLIC_ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx)
{
NTSTATUS nt_status;
struct auth_session_info *session_info = NULL;
nt_status = auth_anonymous_session_info(mem_ctx, lp_ctx, &session_info);
nt_status = auth_anonymous_session_info(mem_ctx, event_ctx, lp_ctx, &session_info);
if (!NT_STATUS_IS_OK(nt_status)) {
return NULL;
}
@ -43,6 +44,7 @@ _PUBLIC_ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx,
}
_PUBLIC_ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info **_session_info)
{
@ -60,7 +62,7 @@ _PUBLIC_ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
}
/* references the server_info into the session_info */
nt_status = auth_generate_session_info(parent_ctx, lp_ctx, server_info, &session_info);
nt_status = auth_generate_session_info(parent_ctx, event_ctx, lp_ctx, server_info, &session_info);
talloc_free(mem_ctx);
NT_STATUS_NOT_OK_RETURN(nt_status);
@ -151,6 +153,7 @@ _PUBLIC_ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx,
}
_PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct auth_serversupplied_info *server_info,
struct auth_session_info **_session_info)
@ -168,6 +171,7 @@ _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
session_info->session_key = server_info->user_session_key;
nt_status = security_token_create(session_info,
event_ctx,
lp_ctx,
server_info->account_sid,
server_info->primary_group_sid,

View File

@ -36,6 +36,7 @@ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx,
const char *netbios_name,
struct auth_serversupplied_info **_server_info) ;
NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct auth_serversupplied_info *server_info,
struct auth_session_info **_session_info) ;
@ -46,10 +47,12 @@ NTSTATUS make_server_info_netlogon_validation(TALLOC_CTX *mem_ctx,
union netr_Validation *validation,
struct auth_serversupplied_info **_server_info);
NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info **_session_info);
struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx);

View File

@ -4,8 +4,6 @@ dnl Copyright (C) 2004 Stefan Metzmacher
dnl Copyright (C) 2004-2005 Jelmer Vernooij
dnl Published under the GPL
dnl
dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems)
dnl
dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
dnl
dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
@ -22,9 +20,9 @@ dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems,cflags)
AC_DEFUN([SMB_SUBSYSTEM],
[
MAKE_SETTINGS="$MAKE_SETTINGS
$1_OBJ_FILES = $2
$1_CFLAGS = $4
$1_ENABLE = YES
$1_OBJ_FILES = $2
"
SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
@ -43,10 +41,10 @@ dnl SMB_LIBRARY(name,obj_files,required_subsystems,cflags,ldflags)
AC_DEFUN([SMB_LIBRARY],
[
MAKE_SETTINGS="$MAKE_SETTINGS
$1_CFLAGS = $6
$1_LDFLAGS = $7
n1_ENABLE = YES
$1_OBJ_FILES = $2
$1_CFLAGS = $4
$1_LDFLAGS = $5
$1_ENABLE = YES
"
SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES

View File

@ -56,3 +56,7 @@ clean::
pydoctor:: pythonmods
LD_LIBRARY_PATH=bin/shared PYTHONPATH=$(pythonbuilddir) pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package $(pythonbuilddir)/samba
bin/python/%.py:
mkdir -p $(@D)
cp $< $@

View File

@ -211,8 +211,9 @@ include/includes.d: include/includes.h
@echo "Compiling $<"
@-mkdir -p `dirname $@`
@$(COMPILE) && exit 0 ; \
$(COMPILE)
echo "The following command failed:" 1>&2;\
echo "$(COMPILE)" 1>&2;\
$(COMPILE) >/dev/null 2>&1
.c.ho:

View File

@ -84,13 +84,19 @@ sub check_module($$$)
return if ($mod->{ENABLE} ne "YES");
if (exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE})) {
$mod->{INIT_FUNCTION_TYPE} = $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE};
} else {
$mod->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)";
}
unless (defined($mod->{INIT_FUNCTION_SENTINEL})) { $mod->{INIT_FUNCTION_SENTINEL} = "NULL"; }
if (not defined($mod->{OUTPUT_TYPE})) {
if (not defined($INPUT->{$mod->{SUBSYSTEM}}->{TYPE})) {
die("Invalid type for subsystem $mod->{SUBSYSTEM}");
}
if ($INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") {
$mod->{OUTPUT_TYPE} = undef;
} else {
@ -119,16 +125,6 @@ sub check_library($$$)
unless (defined($lib->{OUTPUT_TYPE})) { $lib->{OUTPUT_TYPE} = $default_ot; }
if (defined($lib->{VERSION}) and not defined($lib->{SO_VERSION})) {
print "$lib->{NAME}: Please specify SO_VERSION when specifying VERSION\n";
return;
}
if (defined($lib->{SO_VERSION}) and not defined($lib->{VERSION})) {
print "$lib->{NAME}: Please specify VERSION when specifying SO_VERSION\n";
return;
}
unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; }
unless (defined($lib->{INSTALLDIR})) { $lib->{INSTALLDIR} = "LIBDIR"; }

View File

@ -43,8 +43,7 @@ my $mkenv = new smb_build::makefile(\%config::config, $mkfile);
my $shared_libs_used = 0;
foreach my $key (values %$OUTPUT) {
$mkenv->_prepare_list($key, "OBJ_LIST");
push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_LIST)");
push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_FILES)");
}
foreach my $key (values %$OUTPUT) {
@ -52,7 +51,7 @@ foreach my $key (values %$OUTPUT) {
$mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
$mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
$mkenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and
$kenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and
grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
if ($key->{TYPE} eq "LIBRARY" and
${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") {
@ -68,21 +67,20 @@ foreach my $key (values %$OUTPUT) {
foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
$mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
$mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
}
foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
$mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
$mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and
grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
$mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" and
grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}));
$mkenv->PythonModule($key) if ($key->{TYPE} eq "PYTHON");
$mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
$mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER}) or
defined($key->{PUBLIC_PROTO_HEADER});
$mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER});
$mkenv->InitFunctions($key) if defined($key->{INIT_FUNCTIONS});
}

View File

@ -139,6 +139,14 @@ sub SharedModule($$)
}
}
sub StaticLibraryPrimitives($$)
{
my ($self,$ctx) = @_;
$self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
}
sub SharedLibraryPrimitives($$)
{
my ($self,$ctx) = @_;

View File

@ -187,7 +187,7 @@ static void cldapd_task_init(struct task_server *task)
}
cldapd->task = task;
cldapd->samctx = samdb_connect(cldapd, task->lp_ctx, anonymous_session(cldapd, task->lp_ctx));
cldapd->samctx = samdb_connect(cldapd, task->event_ctx, task->lp_ctx, anonymous_session(cldapd, task->event_ctx, task->lp_ctx));
if (cldapd->samctx == NULL) {
task_server_terminate(task, "cldapd failed to open samdb");
return;

View File

@ -20,7 +20,6 @@
*/
#include "includes.h"
#include "libcli/ldap/ldap_ndr.h"
#include "lib/ldb/include/ldb.h"
#include "lib/ldb/include/ldb_errors.h"
#include "lib/events/events.h"
@ -28,6 +27,7 @@
#include "smbd/service_task.h"
#include "cldap_server/cldap_server.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "libcli/ldap/ldap_ndr.h"
#include "dsdb/samdb/samdb.h"
#include "auth/auth.h"
#include "ldb_wrap.h"

View File

@ -24,6 +24,7 @@
#include "lib/cmdline/popt_common.h"
#include "libcli/resolve/resolve.h"
#include "libcli/raw/libcliraw.h"
#include "lib/events/events.h"
#include "cifsdd.h"
#include "param/param.h"
@ -354,6 +355,7 @@ static void print_transfer_stats(void)
}
static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * which, const char **ports,
struct smbcli_options *smb_options)
{
@ -375,13 +377,13 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
if (strcmp(which, "if") == 0) {
path = check_arg_pathname("if");
handle = dd_open_path(resolve_ctx, path, ports,
handle = dd_open_path(resolve_ctx, ev, path, ports,
check_arg_numeric("ibs"), options,
smb_options);
} else if (strcmp(which, "of") == 0) {
options |= DD_WRITE;
path = check_arg_pathname("of");
handle = dd_open_path(resolve_ctx, path, ports,
handle = dd_open_path(resolve_ctx, ev, path, ports,
check_arg_numeric("obs"), options,
smb_options);
} else {
@ -396,7 +398,7 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
return(handle);
}
static int copy_files(struct loadparm_context *lp_ctx)
static int copy_files(struct event_context *ev, struct loadparm_context *lp_ctx)
{
uint8_t * iobuf; /* IO buffer. */
uint64_t iomax; /* Size of the IO buffer. */
@ -433,12 +435,12 @@ static int copy_files(struct loadparm_context *lp_ctx)
DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n",
(unsigned long long)iomax, options.max_xmit));
if (!(ifile = open_file(lp_resolve_context(lp_ctx), "if",
if (!(ifile = open_file(lp_resolve_context(lp_ctx), ev, "if",
lp_smb_ports(lp_ctx), &options))) {
return(FILESYS_EXIT_CODE);
}
if (!(ofile = open_file(lp_resolve_context(lp_ctx), "of",
if (!(ofile = open_file(lp_resolve_context(lp_ctx), ev, "of",
lp_smb_ports(lp_ctx), &options))) {
return(FILESYS_EXIT_CODE);
}
@ -528,6 +530,7 @@ int main(int argc, const char ** argv)
{
int i;
const char ** dd_args;
struct event_context *ev;
poptContext pctx;
struct poptOption poptions[] = {
@ -578,6 +581,8 @@ int main(int argc, const char ** argv)
}
}
ev = event_context_init(talloc_autofree_context());
gensec_init(cmdline_lp_ctx);
dump_args();
@ -599,7 +604,7 @@ int main(int argc, const char ** argv)
CatchSignal(SIGINT, dd_handle_signal);
CatchSignal(SIGUSR1, dd_handle_signal);
return(copy_files(cmdline_lp_ctx));
return(copy_files(ev, cmdline_lp_ctx));
}
/* vim: set sw=8 sts=8 ts=8 tw=79 : */

View File

@ -89,8 +89,10 @@ struct dd_iohandle
#define DD_OPLOCK 0x00000008
struct smbcli_options;
struct event_context;
struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * path,
const char **ports,
uint64_t io_size, int options,

View File

@ -221,6 +221,7 @@ static bool smb_write_func(void * handle, uint8_t * buf, uint64_t wanted,
}
static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * host,
const char **ports,
const char * share,
@ -233,8 +234,9 @@ static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ct
* each connection, but for now, we just use the same one for both.
*/
ret = smbcli_full_connection(NULL, &cli, host, ports, share,
NULL /* devtype */, cmdline_credentials, resolve_ctx,
NULL /* events */, options);
NULL /* devtype */,
cmdline_credentials, resolve_ctx,
ev, options);
if (!NT_STATUS_IS_OK(ret)) {
fprintf(stderr, "%s: connecting to //%s/%s: %s\n",
@ -293,6 +295,7 @@ static int open_smb_file(struct smbcli_state * cli,
}
static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * host,
const char **ports,
const char * share,
@ -319,7 +322,7 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
smbh->h.io_write = smb_write_func;
smbh->h.io_seek = smb_seek_func;
if ((smbh->cli = init_smb_session(resolve_ctx, host, ports, share,
if ((smbh->cli = init_smb_session(resolve_ctx, ev, host, ports, share,
smb_options)) == NULL) {
return(NULL);
}
@ -336,6 +339,7 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
/* ------------------------------------------------------------------------- */
struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
struct event_context *ev,
const char * path,
const char **ports,
uint64_t io_size,
@ -355,7 +359,7 @@ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
/* Skip over leading directory separators. */
while (*remain == '/' || *remain == '\\') { remain++; }
return(open_cifs_handle(resolve_ctx, host, ports,
return(open_cifs_handle(resolve_ctx, ev, host, ports,
share, remain,
io_size, options, smb_options));
}

View File

@ -32,6 +32,7 @@
#include "includes.h"
#include "version.h"
#include "libcli/libcli.h"
#include "lib/events/events.h"
#include "lib/cmdline/popt_common.h"
#include "librpc/gen_ndr/ndr_srvsvc_c.h"
#include "librpc/gen_ndr/ndr_lsa.h"
@ -2545,7 +2546,9 @@ static void display_share_result(struct srvsvc_NetShareCtr1 *ctr1)
/****************************************************************************
try and browse available shares on a host
****************************************************************************/
static bool browse_host(struct loadparm_context *lp_ctx, const char *query_host)
static bool browse_host(struct loadparm_context *lp_ctx,
struct event_context *ev_ctx,
const char *query_host)
{
struct dcerpc_pipe *p;
char *binding;
@ -2559,7 +2562,7 @@ static bool browse_host(struct loadparm_context *lp_ctx, const char *query_host)
status = dcerpc_pipe_connect(mem_ctx, &p, binding,
&ndr_table_srvsvc,
cmdline_credentials, NULL,
cmdline_credentials, ev_ctx,
lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Failed to connect to %s - %s\n",
@ -3021,6 +3024,7 @@ static int process_stdin(struct smbclient_context *ctx)
return a connection to a server
*******************************************************/
static bool do_connect(struct smbclient_context *ctx,
struct event_context *ev_ctx,
struct resolve_context *resolve_ctx,
const char *specified_server, const char **ports,
const char *specified_share,
@ -3044,8 +3048,7 @@ static bool do_connect(struct smbclient_context *ctx,
status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
share, NULL, cred, resolve_ctx,
cli_credentials_get_event_context(cred),
options);
ev_ctx, options);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to \\\\%s\\%s failed - %s\n",
server, share, nt_errstr(status));
@ -3059,9 +3062,12 @@ static bool do_connect(struct smbclient_context *ctx,
/****************************************************************************
handle a -L query
****************************************************************************/
static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host, const char *workgroup)
static int do_host_query(struct loadparm_context *lp_ctx,
struct event_context *ev_ctx,
const char *query_host,
const char *workgroup)
{
browse_host(lp_ctx, query_host);
browse_host(lp_ctx, ev_ctx, query_host);
list_servers(workgroup);
return(0);
}
@ -3070,7 +3076,12 @@ static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host
/****************************************************************************
handle a message operation
****************************************************************************/
static int do_message_op(const char *netbios_name, const char *desthost, const char **destports, const char *destip, int name_type, struct resolve_context *resolve_ctx, struct smbcli_options *options)
static int do_message_op(const char *netbios_name, const char *desthost,
const char **destports, const char *destip,
int name_type,
struct event_context *ev_ctx,
struct resolve_context *resolve_ctx,
struct smbcli_options *options)
{
struct nbt_name called, calling;
const char *server_name;
@ -3082,7 +3093,9 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
server_name = destip ? destip : desthost;
if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, destports, resolve_ctx, options)) {
if (!(cli = smbcli_state_init(NULL)) ||
!smbcli_socket_connect(cli, server_name, destports,
ev_ctx, resolve_ctx, options)) {
d_printf("Connection to %s failed\n", server_name);
return 1;
}
@ -3123,6 +3136,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
int rc = 0;
int name_type = 0x20;
TALLOC_CTX *mem_ctx;
struct event_context *ev_ctx;
struct smbclient_context *ctx;
const char *cmdstr = NULL;
struct smbcli_options smb_options;
@ -3220,6 +3234,8 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
lp_smbcli_options(cmdline_lp_ctx, &smb_options);
ev_ctx = event_context_init(talloc_autofree_context());
DEBUG( 3, ( "Client started (version %s).\n", SAMBA_VERSION_STRING ) );
if (query_host && (p=strchr_m(query_host,'#'))) {
@ -3229,14 +3245,23 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
}
if (query_host) {
return do_host_query(cmdline_lp_ctx, query_host, lp_workgroup(cmdline_lp_ctx));
rc = do_host_query(cmdline_lp_ctx, ev_ctx, query_host,
lp_workgroup(cmdline_lp_ctx));
return rc;
}
if (message) {
return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), dest_ip, name_type, lp_resolve_context(cmdline_lp_ctx), &smb_options);
rc = do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost,
lp_smb_ports(cmdline_lp_ctx), dest_ip,
name_type, ev_ctx,
lp_resolve_context(cmdline_lp_ctx),
&smb_options);
return rc;
}
if (!do_connect(ctx, lp_resolve_context(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials, &smb_options))
if (!do_connect(ctx, ev_ctx, lp_resolve_context(cmdline_lp_ctx),
desthost, lp_smb_ports(cmdline_lp_ctx), service,
cmdline_credentials, &smb_options))
return 1;
if (base_directory)

View File

@ -21,7 +21,7 @@ extern int LogLevel;
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
#ifndef discard_const
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
#endif
struct timeval timeval_zero(void);

View File

@ -49,14 +49,15 @@ struct sidmap_context {
/*
open a sidmap context - use talloc_free to close
*/
struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx,
struct loadparm_context *lp_ctx)
{
struct sidmap_context *sidmap;
sidmap = talloc(mem_ctx, struct sidmap_context);
if (sidmap == NULL) {
return NULL;
}
sidmap->samctx = samdb_connect(sidmap, lp_ctx, system_session(sidmap, lp_ctx));
sidmap->samctx = samdb_connect(sidmap, ev_ctx, lp_ctx, system_session(sidmap, lp_ctx));
if (sidmap->samctx == NULL) {
talloc_free(sidmap);
return NULL;

View File

@ -51,7 +51,7 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct lo
const struct GUID *ntds_guid;
struct drsuapi_DsBindInfo28 *bind_info28;
service->samdb = samdb_connect(service, lp_ctx, service->system_session_info);
service->samdb = samdb_connect(service, service->task->event_ctx, lp_ctx, service->system_session_info);
if (!service->samdb) {
return WERR_DS_SERVICE_UNAVAILABLE;
}

View File

@ -1197,6 +1197,7 @@ NTSTATUS crack_service_principal_name(struct ldb_context *sam_ctx,
}
NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
uint32_t format_offered,
const char *name,
@ -1214,7 +1215,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
ldb = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
ldb = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
if (ldb == NULL) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@ -1259,6 +1260,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
}
NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
const char *name,
const char **nt4_domain,
@ -1283,5 +1285,5 @@ NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx,
format_offered = DRSUAPI_DS_NAME_FORMAT_CANONICAL;
}
return crack_name_to_nt4_name(mem_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account);
return crack_name_to_nt4_name(mem_ctx, ev_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account);
}

View File

@ -4,7 +4,11 @@
SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC
<<<<<<< HEAD:source/dsdb/samdb/ldb_modules/config.mk
INIT_FUNCTION = LDB_MODULE(objectguid)
=======
INIT_FUNCTION = objectguid_module_module_ops
>>>>>>> 5f3a70f285ad8a412105c0e498e486f93fc279bc:source/dsdb/samdb/ldb_modules/config.mk
# End MODULE ldb_objectguid
################################################
@ -21,7 +25,8 @@ INIT_FUNCTION = LDB_MODULE(repl_meta_data)
# End MODULE ldb_repl_meta_data
################################################
ldb_repl_meta_data_OBJ_FILES = dsdb/samdb/ldb_modules/repl_meta_data.o
ldb_repl_meta_data_OBJ_FILES = \
dsdb/samdb/ldb_modules/repl_meta_data.o
################################################
# Start MODULE ldb_dsdb_cache
@ -33,7 +38,8 @@ INIT_FUNCTION = LDB_MODULE(dsdb_cache)
# End MODULE ldb_dsdb_cache
################################################
ldb_dsdb_cache_OBJ_FILES = dsdb/samdb/ldb_modules/dsdb_cache.o
ldb_dsdb_cache_OBJ_FILES = \
dsdb/samdb/ldb_modules/dsdb_cache.o
################################################
# Start MODULE ldb_schema_fsmo
@ -45,7 +51,8 @@ INIT_FUNCTION = LDB_MODULE(schema_fsmo)
# End MODULE ldb_schema_fsmo
################################################
ldb_schema_fsmo_OBJ_FILES = dsdb/samdb/ldb_modules/schema_fsmo.o
ldb_schema_fsmo_OBJ_FILES = \
dsdb/samdb/ldb_modules/schema_fsmo.o
################################################
# Start MODULE ldb_naming_fsmo
@ -57,7 +64,8 @@ INIT_FUNCTION = LDB_MODULE(naming_fsmo)
# End MODULE ldb_naming_fsmo
################################################
ldb_naming_fsmo_OBJ_FILES = dsdb/samdb/ldb_modules/naming_fsmo.o
ldb_naming_fsmo_OBJ_FILES = \
dsdb/samdb/ldb_modules/naming_fsmo.o
################################################
# Start MODULE ldb_pdc_fsmo
@ -69,7 +77,8 @@ INIT_FUNCTION = LDB_MODULE(pdc_fsmo)
# End MODULE ldb_pdc_fsmo
################################################
ldb_pdc_fsmo_OBJ_FILES = dsdb/samdb/ldb_modules/pdc_fsmo.o
ldb_pdc_fsmo_OBJ_FILES = \
dsdb/samdb/ldb_modules/pdc_fsmo.o
################################################
# Start MODULE ldb_samldb
@ -78,10 +87,12 @@ SUBSYSTEM = LIBLDB
OUTPUT_TYPE = SHARED_LIBRARY
PRIVATE_DEPENDENCIES = LIBTALLOC LDAP_ENCODE NDR_MISC SAMDB
INIT_FUNCTION = LDB_MODULE(samldb)
#
# End MODULE ldb_samldb
################################################
ldb_samldb_OBJ_FILES = dsdb/samdb/ldb_modules/samldb.o
ldb_samldb_OBJ_FILES = \
dsdb/samdb/ldb_modules/samldb.o
################################################
# Start MODULE ldb_samba3sam
@ -94,7 +105,8 @@ PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map SMBPASSWD NSS_WRAPPER LIBSECURITY \
# End MODULE ldb_samldb
################################################
ldb_samba3sam_OBJ_FILES = dsdb/samdb/ldb_modules/samba3sam.o
ldb_samba3sam_OBJ_FILES = \
dsdb/samdb/ldb_modules/samba3sam.o
################################################
# Start MODULE ldb_simple_ldap_map
@ -108,7 +120,8 @@ ALIASES = entryuuid nsuniqueid
# End MODULE ldb_entryuuid
################################################
ldb_simple_ldap_map_OBJ_FILES = dsdb/samdb/ldb_modules/simple_ldap_map.o
ldb_simple_ldap_map_OBJ_FILES = \
dsdb/samdb/ldb_modules/simple_ldap_map.o
# ################################################
# # Start MODULE ldb_proxy

View File

@ -26,6 +26,7 @@
#include "lib/ldb/include/ldb_private.h"
#include "system/time.h"
#include "dsdb/samdb/samdb.h"
#include "version.h"
struct private_data {
int num_controls;
@ -202,6 +203,13 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms
}
}
if (schema && do_attribute_explicit(attrs, "vendorVersion")) {
if (ldb_msg_add_fmt(msg, "vendorVersion",
"%s", SAMBA_VERSION_STRING) != 0) {
goto failed;
}
}
/* TODO: lots more dynamic attributes should be added here */
return LDB_SUCCESS;

View File

@ -484,8 +484,7 @@ static int samldb_fill_group_object(struct ldb_module *module, const struct ldb_
return ret;
}
static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg,
struct ldb_message **ret_msg)
static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg, struct ldb_message **ret_msg)
{
int ret;
char *name;

View File

@ -90,7 +90,7 @@ static int add_modified(struct ldb_module *module, struct ldb_dn *dn, bool delet
}
cli_credentials_set_conf(item->creds, ldb_get_opaque(module->ldb, "loadparm"));
status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter);
status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter);
talloc_free(filter);
if (NT_STATUS_IS_OK(status)) {
if (delete) {
@ -158,7 +158,7 @@ static int update_kt_end_trans(struct ldb_module *module)
struct dn_list *p;
for (p=data->changed_dns; p; p = p->next) {
int kret;
kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "loadparm"));
kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm"));
if (kret != 0) {
talloc_free(data->changed_dns);
data->changed_dns = NULL;

View File

@ -37,6 +37,7 @@
#include "dsdb/samdb/samdb.h"
#include "dsdb/common/flags.h"
#include "param/param.h"
#include "lib/events/events.h"
char *samdb_relative_path(struct ldb_context *ldb,
TALLOC_CTX *mem_ctx,
@ -71,11 +72,12 @@ char *samdb_relative_path(struct ldb_context *ldb,
return an opaque context pointer on success, or NULL on failure
*/
struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *session_info)
{
struct ldb_context *ldb;
ldb = ldb_wrap_connect(mem_ctx, lp_ctx,
ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx,
lp_sam_url(lp_ctx), session_info,
NULL, 0, NULL);
if (!ldb) {
@ -98,6 +100,8 @@ int samdb_copy_template(struct ldb_context *ldb,
struct ldb_context *templates_ldb;
char *templates_ldb_path;
struct ldb_dn *basedn;
struct event_context *event_ctx;
struct loadparm_context *lp_ctx;
templates_ldb = talloc_get_type(ldb_get_opaque(ldb, "templates_ldb"), struct ldb_context);
@ -109,8 +113,17 @@ int samdb_copy_template(struct ldb_context *ldb,
*errstring = talloc_asprintf(msg, "samdb_copy_template: ERROR: Failed to contruct path for template db");
return LDB_ERR_OPERATIONS_ERROR;
}
event_ctx = (struct event_context *)ldb_get_opaque(ldb, "EventContext");
lp_ctx = (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm");
templates_ldb = ldb_wrap_connect(ldb, (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm"),
/* FIXME: need to remove this wehn we finally pass the event
* context around in ldb */
if (event_ctx == NULL) {
event_ctx = event_context_init(templates_ldb);
}
templates_ldb = ldb_wrap_connect(ldb, event_ctx, lp_ctx,
templates_ldb_path, NULL,
NULL, 0, NULL);
talloc_free(templates_ldb_path);
@ -184,6 +197,7 @@ int samdb_copy_template(struct ldb_context *ldb,
Create the SID list for this user.
****************************************************************************/
NTSTATUS security_token_create(TALLOC_CTX *mem_ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct dom_sid *user_sid,
struct dom_sid *group_sid,
@ -242,7 +256,7 @@ NTSTATUS security_token_create(TALLOC_CTX *mem_ctx,
}
/* setup the privilege mask for this token */
status = samdb_privilege_setup(lp_ctx, ptoken);
status = samdb_privilege_setup(ev_ctx, lp_ctx, ptoken);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(ptoken);
return status;

View File

@ -27,6 +27,7 @@ struct dsdb_control_current_partition;
struct dsdb_extended_replicated_object;
struct dsdb_extended_replicated_objects;
struct loadparm_context;
struct event_context;
#include "librpc/gen_ndr/security.h"
#include "lib/ldb/include/ldb.h"

View File

@ -73,7 +73,8 @@ static NTSTATUS samdb_privilege_setup_sid(void *samctx, TALLOC_CTX *mem_ctx,
setup the privilege mask for this security token based on our
local SAM
*/
NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_token *token)
NTSTATUS samdb_privilege_setup(struct event_context *ev_ctx,
struct loadparm_context *lp_ctx, struct security_token *token)
{
void *samctx;
TALLOC_CTX *mem_ctx;
@ -97,7 +98,7 @@ NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_
}
mem_ctx = talloc_new(token);
samctx = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
samctx = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
if (samctx == NULL) {
talloc_free(mem_ctx);
return NT_STATUS_INTERNAL_DB_CORRUPTION;

View File

@ -50,6 +50,7 @@
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "libcli/auth/libcli_auth.h"
#include "param/param.h"
#include "events/events.h"
enum hdb_ldb_ent_type
{ HDB_LDB_ENT_TYPE_CLIENT, HDB_LDB_ENT_TYPE_SERVER,
@ -1106,6 +1107,7 @@ static krb5_error_code LDB_destroy(krb5_context context, HDB *db)
* code */
NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
krb5_context context, struct HDB **db, const char *arg)
{
@ -1137,7 +1139,7 @@ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
CRED_DONT_USE_KERBEROS);
/* Setup the link to LDB */
(*db)->hdb_db = samdb_connect(*db, lp_ctx, session_info);
(*db)->hdb_db = samdb_connect(*db, ev_ctx, lp_ctx, session_info);
if ((*db)->hdb_db == NULL) {
DEBUG(1, ("hdb_ldb_create: Cannot open samdb for KDC backend!"));
return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
@ -1168,7 +1170,7 @@ krb5_error_code hdb_ldb_create(krb5_context context, struct HDB **db, const char
{
NTSTATUS nt_status;
/* The global kdc_mem_ctx and kdc_lp_ctx, Disgusting, ugly hack, but it means one less private hook */
nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, kdc_lp_ctx,
nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, event_context_find(kdc_mem_ctx), kdc_lp_ctx,
context, db, arg);
if (NT_STATUS_IS_OK(nt_status)) {

View File

@ -624,7 +624,7 @@ static void kdc_task_init(struct task_server *task)
}
kdc->config->num_db = 1;
status = kdc_hdb_ldb_create(kdc, task->lp_ctx,
status = kdc_hdb_ldb_create(kdc, task->event_ctx, task->lp_ctx,
kdc->smb_krb5_context->krb5_context,
&kdc->config->db[0], NULL);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -180,7 +180,7 @@ static bool kpasswdd_change_password(struct kdc_server *kdc,
struct samr_DomInfo1 *dominfo;
struct ldb_context *samdb;
samdb = samdb_connect(mem_ctx, kdc->task->lp_ctx, system_session(mem_ctx, kdc->task->lp_ctx));
samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx, system_session(mem_ctx, kdc->task->lp_ctx));
if (!samdb) {
return kpasswdd_make_error_reply(kdc, mem_ctx,
KRB5_KPASSWD_HARDERROR,
@ -310,7 +310,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc,
krb5_free_principal(context, principal);
samdb = samdb_connect(mem_ctx, kdc->task->lp_ctx, session_info);
samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx, session_info);
if (!samdb) {
return kpasswdd_make_error_reply(kdc, mem_ctx,
KRB5_KPASSWD_HARDERROR,
@ -474,7 +474,7 @@ bool kpasswdd_process(struct kdc_server *kdc,
* we already have, rather than a new context */
cli_credentials_set_krb5_context(server_credentials, kdc->smb_krb5_context);
cli_credentials_set_conf(server_credentials, kdc->task->lp_ctx);
nt_status = cli_credentials_set_stored_principal(server_credentials, kdc->task->lp_ctx, "kadmin/changepw");
nt_status = cli_credentials_set_stored_principal(server_credentials, kdc->task->event_ctx, kdc->task->lp_ctx, "kadmin/changepw");
if (!NT_STATUS_IS_OK(nt_status)) {
ret = kpasswdd_make_unauth_error_reply(kdc, mem_ctx,
KRB5_KPASSWD_HARDERROR,

View File

@ -27,6 +27,7 @@
#include "auth/credentials/credentials.h"
#include "auth/gensec/gensec.h"
#include "param/param.h"
#include "smbd/service_stream.h"
#define VALID_DN_SYNTAX(dn,i) do {\
if (!(dn)) {\
@ -56,6 +57,7 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin
NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn)
{
conn->ldb = ldb_wrap_connect(conn,
conn->connection->event.ctx,
conn->lp_ctx,
lp_sam_url(conn->lp_ctx),
conn->session_info,

View File

@ -44,7 +44,7 @@ static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
DEBUG(10, ("BindSimple dn: %s\n",req->dn));
status = crack_auto_name_to_nt4_name(call, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account);
status = crack_auto_name_to_nt4_name(call, call->conn->connection->event.ctx, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account);
if (NT_STATUS_IS_OK(status)) {
status = authenticate_username_pw(call,
call->conn->connection->event.ctx,

View File

@ -409,7 +409,7 @@ static void ldapsrv_accept(struct stream_connection *c)
conn->server_credentials = server_credentials;
/* Connections start out anonymous */
if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, conn->lp_ctx, &conn->session_info))) {
if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, c->event.ctx, conn->lp_ctx, &conn->session_info))) {
ldapsrv_terminate_connection(conn, "failed to setup anonymous session info");
return;
}
@ -478,7 +478,8 @@ static NTSTATUS add_socket(struct event_context *event_context,
}
/* Load LDAP database */
ldb = samdb_connect(ldap_service, lp_ctx, system_session(ldap_service, lp_ctx));
ldb = samdb_connect(ldap_service, ldap_service->task->event_ctx,
lp_ctx, system_session(ldap_service, lp_ctx));
if (!ldb) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}

View File

@ -31,6 +31,7 @@
#include "miniMpr.h"
#include "param/param.h"
#include "lib/events/events.h"
/************************************ Code ************************************/
#if !BLD_APPWEB
@ -50,6 +51,11 @@ void *mprMemCtx(void)
return mpr_ctx;
}
struct event_context *mprEventCtx(void)
{
return event_context_find(mprMemCtx());
}
/* return the loadparm context being used for all ejs variables */
struct loadparm_context *mprLpCtx(void)
{

View File

@ -274,6 +274,8 @@ extern void mprSetCtx(void *ctx);
extern void *mprMemCtx(void);
struct loadparm_context;
extern struct loadparm_context *mprLpCtx(void);
struct event_context;
extern struct event_context *mprEventCtx(void);
/* This function needs to be provided by anyone using ejs */
void ejs_exception(const char *reason);

View File

@ -5,7 +5,6 @@ mkinclude charset/config.mk
mkinclude ldb-samba/config.mk
mkinclude tls/config.mk
mkinclude registry/config.mk
mkinclude policy/config.mk
mkinclude messaging/config.mk
mkinclude events/config.mk
mkinclude cmdline/config.mk
@ -41,3 +40,5 @@ PUBLIC_DEPENDENCIES = LIBTDB
TDB_WRAP_OBJ_FILES = lib/tdb_wrap.o
PUBLIC_HEADERS += lib/tdb_wrap.h
SMBREADLINE_OBJ_LIST = $(SMBREADLINE_OBJ_FILES)

View File

@ -33,10 +33,8 @@ EVENTS_STANDARD_OBJ_FILES = lib/events/events_standard.o
##############################
# Start SUBSYSTEM LIBEVENTS
[LIBRARY::LIBEVENTS]
[SUBSYSTEM::LIBEVENTS]
PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL
SO_VERSION = 0
VERSION = 0.0.1
# End SUBSYSTEM LIBEVENTS
##############################

View File

@ -102,6 +102,7 @@ static void event_backend_init(void)
NTSTATUS s4_events_standard_init(void);
NTSTATUS s4_events_select_init(void);
NTSTATUS s4_events_epoll_init(void);
NTSTATUS s4_events_aio_init(void);
init_module_fn static_init[] = { STATIC_LIBEVENTS_MODULES };
if (event_backends) return;
run_init_functions(static_init);

View File

@ -251,6 +251,14 @@ fail:
#ifdef SWIGPYTHON
%{
struct ldb_context *ldb_context_from_py_object(PyObject *py_obj)
{
struct ldb_context *ldb_ctx;
if (SWIG_ConvertPtr(py_obj, (void *)&ldb_ctx, SWIGTYPE_p_ldb_context, 0 | 0 ) < 0)
return NULL;
return ldb_ctx;
}
int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object,
struct ldb_context *ldb_ctx, ldb_dn **dn)
{

View File

@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.33
# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
@ -99,7 +99,7 @@ Dn_swigregister(Dn)
class ldb_msg_element(object):
thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
def __init__(self): raise AttributeError, "No constructor defined"
def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
__repr__ = _swig_repr
__swig_destroy__ = _ldb.delete_ldb_msg_element
def __getitem__(self, i):

View File

@ -737,6 +737,7 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
struct ildb_private *ildb;
NTSTATUS status;
struct cli_credentials *creds;
struct event_context *event_ctx;
module = talloc(ldb, struct ldb_module);
if (!module) {
@ -756,8 +757,19 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
}
module->private_data = ildb;
ildb->module = module;
ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "loadparm"),
ldb_get_opaque(ldb, "EventContext"));
event_ctx = ldb_get_opaque(ldb, "EventContext");
/* FIXME: We must make the event context an explicit parameter, but we
* need to build the events library separately first. Hack a new event
* context so that CMD line utilities work until we have libevents for
* standalone builds ready */
if (event_ctx == NULL) {
event_ctx = event_context_init(NULL);
}
ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "loadparm"),
event_ctx);
if (!ildb->ldap) {
ldb_oom(ldb);
goto failed;

View File

@ -545,7 +545,7 @@ static int ltdb_index_dn_one(struct ldb_module *module,
/* the attribute is indexed. Pull the list of DNs that match the
search criterion */
val.data = (uint8_t *)((intptr_t)ldb_dn_get_casefold(parent_dn));
val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(parent_dn));
val.length = strlen((char *)val.data);
key = ltdb_index_key(ldb, LTDB_IDXONE, &val);
if (!key) {
@ -1140,7 +1140,7 @@ int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int
return LDB_ERR_OPERATIONS_ERROR;
}
val.data = (uint8_t *)((intptr_t)ldb_dn_get_casefold(pdn));
val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(pdn));
if (val.data == NULL) {
talloc_free(pdn);
return LDB_ERR_OPERATIONS_ERROR;

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.33
* Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@ -126,7 +126,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "3"
#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@ -161,6 +161,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
extern "C" {
#endif
typedef void *(*swig_converter_func)(void *);
typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
/* Structure to store inforomation on one type */
/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
Py_DECREF(old_str);
Py_DECREF(value);
} else {
PyErr_Format(PyExc_RuntimeError, mesg);
PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
{
PySwigObject *sobj = (PySwigObject *) v;
PyObject *next = sobj->next;
if (sobj->own) {
if (sobj->own == SWIG_POINTER_OWN) {
swig_type_info *ty = sobj->ty;
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
res = ((*meth)(mself, v));
}
Py_XDECREF(res);
} else {
const char *name = SWIG_TypePrettyName(ty);
}
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
#endif
else {
const char *name = SWIG_TypePrettyName(ty);
printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
#endif
}
Py_XDECREF(next);
PyObject_DEL(v);
@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
if (own) {
if (own == SWIG_POINTER_OWN) {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
return SWIG_OK;
} else {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (own)
*own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
if (!tc) {
sobj = (PySwigObject *)sobj->next;
} else {
if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
if (ptr) {
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
if (newmemory == SWIG_CAST_NEW_MEMORY) {
assert(own);
if (own)
*own = *own | SWIG_CAST_NEW_MEMORY;
}
}
break;
}
}
@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
}
}
if (sobj) {
if (own) *own = sobj->own;
if (own)
*own = *own | sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
}
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
if (!tc) return SWIG_ERROR;
*ptr = SWIG_TypeCast(tc,vptr);
if (tc) {
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
} else {
return SWIG_ERROR;
}
} else {
*ptr = vptr;
}
@ -2471,7 +2489,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_ldb_module_ops swig_types[9]
#define SWIGTYPE_p_ldb_result swig_types[10]
#define SWIGTYPE_p_ldb_val swig_types[11]
#define SWIGTYPE_p_long swig_types[12]
#define SWIGTYPE_p_long_long swig_types[12]
#define SWIGTYPE_p_p_char swig_types[13]
#define SWIGTYPE_p_p_ldb_control swig_types[14]
#define SWIGTYPE_p_p_ldb_result swig_types[15]
@ -2480,10 +2498,11 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_unsigned_char swig_types[18]
#define SWIGTYPE_p_unsigned_int swig_types[19]
#define SWIGTYPE_p_unsigned_long swig_types[20]
#define SWIGTYPE_p_unsigned_short swig_types[21]
#define SWIGTYPE_p_void swig_types[22]
static swig_type_info *swig_types[24];
static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
#define SWIGTYPE_p_unsigned_long_long swig_types[21]
#define SWIGTYPE_p_unsigned_short swig_types[22]
#define SWIGTYPE_p_void swig_types[23]
static swig_type_info *swig_types[25];
static swig_module_info swig_module = {swig_types, 24, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -2515,7 +2534,7 @@ static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
#define SWIG_name "_ldb"
#define SWIGVERSION 0x010333
#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
@ -2706,6 +2725,14 @@ SWIGINTERN ldb_dn *ldb_dn___add__(ldb_dn *self,ldb_dn *other){
return ret;
}
struct ldb_context *ldb_context_from_py_object(PyObject *py_obj)
{
struct ldb_context *ldb_ctx;
if (SWIG_ConvertPtr(py_obj, (void *)&ldb_ctx, SWIGTYPE_p_ldb_context, 0 | 0 ) < 0)
return NULL;
return ldb_ctx;
}
int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object,
struct ldb_context *ldb_ctx, ldb_dn **dn)
{
@ -4193,7 +4220,10 @@ check_1:
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n Possible C/C++ prototypes are:\n"" __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n"" __setitem__(ldb_msg *,char const *,PyObject *)\n");
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n"
" Possible C/C++ prototypes are:\n"
" __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n"
" __setitem__(ldb_msg *,char const *,PyObject *)\n");
return NULL;
}
@ -5711,7 +5741,7 @@ static PyMethodDef SwigMethods[] = {
static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void = {"_p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void", "void (*)(void *,enum ldb_debug_level,char const *,va_list)", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *|int_least32_t *|int32_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_context *|ldb *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ldb_dn = {"_p_ldb_dn", "struct ldb_dn *|ldb_dn *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ldb_ldif = {"_p_ldb_ldif", "struct ldb_ldif *|ldb_ldif *", 0, 0, (void*)0, 0};
@ -5720,15 +5750,16 @@ static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element",
static swig_type_info _swigt__p_ldb_module_ops = {"_p_ldb_module_ops", "struct ldb_module_ops *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ldb_result = {"_p_ldb_result", "struct ldb_result *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_ldb_val = {"_p_ldb_val", "struct ldb_val *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_long = {"_p_long", "intptr_t *|int_least64_t *|int_fast32_t *|int_fast64_t *|int64_t *|long *|int_fast16_t *|intmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_ldb_control = {"_p_p_ldb_control", "struct ldb_control **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_p_ldb_result = {"_p_p_ldb_result", "struct ldb_result **", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uint_least32_t *|uint32_t *|unsigned int *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "uintptr_t *|uint_least64_t *|uint_fast32_t *|uint_fast64_t *|uint64_t *|unsigned long *|time_t *|uint_fast16_t *|uintmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "unsigned long *|time_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
@ -5745,7 +5776,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_ldb_module_ops,
&_swigt__p_ldb_result,
&_swigt__p_ldb_val,
&_swigt__p_long,
&_swigt__p_long_long,
&_swigt__p_p_char,
&_swigt__p_p_ldb_control,
&_swigt__p_p_ldb_result,
@ -5754,6 +5785,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_unsigned_char,
&_swigt__p_unsigned_int,
&_swigt__p_unsigned_long,
&_swigt__p_unsigned_long_long,
&_swigt__p_unsigned_short,
&_swigt__p_void,
};
@ -5770,7 +5802,7 @@ static swig_cast_info _swigc__p_ldb_message_element[] = { {&_swigt__p_ldb_messa
static swig_cast_info _swigc__p_ldb_module_ops[] = { {&_swigt__p_ldb_module_ops, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ldb_result[] = { {&_swigt__p_ldb_result, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_ldb_val[] = { {&_swigt__p_ldb_val, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_long[] = { {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_ldb_control[] = { {&_swigt__p_p_ldb_control, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_p_ldb_result[] = { {&_swigt__p_p_ldb_result, 0, 0, 0},{0, 0, 0, 0}};
@ -5779,6 +5811,7 @@ static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_long[] = { {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_long_long[] = { {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_short[] = { {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
@ -5795,7 +5828,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_ldb_module_ops,
_swigc__p_ldb_result,
_swigc__p_ldb_val,
_swigc__p_long,
_swigc__p_long_long,
_swigc__p_p_char,
_swigc__p_p_ldb_control,
_swigc__p_p_ldb_result,
@ -5804,6 +5837,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_unsigned_char,
_swigc__p_unsigned_int,
_swigc__p_unsigned_long,
_swigc__p_unsigned_long_long,
_swigc__p_unsigned_short,
_swigc__p_void,
};
@ -5874,7 +5908,7 @@ SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
int found;
int found, init;
clientdata = clientdata;
@ -5884,6 +5918,9 @@ SWIG_InitializeModule(void *clientdata) {
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
init = 1;
} else {
init = 0;
}
/* Try and load any already created modules */
@ -5912,6 +5949,12 @@ SWIG_InitializeModule(void *clientdata) {
module_head->next = &swig_module;
}
/* When multiple interpeters are used, a module could have already been initialized in
a different interpreter, but not yet have a pointer in this interpreter.
In this case, we do not want to continue adding types... everything should be
set up already */
if (init == 0) return;
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);

View File

@ -94,6 +94,7 @@ static int ldb_wrap_destructor(struct ldb_context *ldb)
TODO: We need an error_string parameter
*/
struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct loadparm_context *lp_ctx,
const char *url,
struct auth_session_info *session_info,
@ -103,7 +104,6 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
{
struct ldb_context *ldb;
int ret;
struct event_context *ev;
char *real_url = NULL;
size_t *startup_blocks;
@ -115,10 +115,9 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
ldb_set_modules_dir(ldb,
talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx)));
/* we want to use the existing event context if possible. This
relies on the fact that in smbd, everything is a child of
the main event_context */
ev = event_context_find(ldb);
if (ev == NULL) {
return NULL;
}
if (ldb_set_opaque(ldb, "EventContext", ev)) {
talloc_free(ldb);

View File

@ -27,10 +27,12 @@ struct ldb_message;
struct ldb_dn;
struct cli_credentials;
struct loadparm_context;
struct event_context;
char *wrap_casefold(void *context, void *mem_ctx, const char *s);
struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct loadparm_context *lp_ctx,
const char *url,
struct auth_session_info *session_info,

View File

@ -544,6 +544,10 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
NTSTATUS status;
struct socket_address *path;
if (ev == NULL) {
return NULL;
}
msg = talloc_zero(mem_ctx, struct messaging_context);
if (msg == NULL) {
return NULL;
@ -556,10 +560,6 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
return NULL;
}
if (ev == NULL) {
ev = event_context_init(msg);
}
/* create the messaging directory if needed */
mkdir(dir, 0700);

View File

@ -134,7 +134,6 @@ static bool test_ping_speed(struct torture_context *tctx)
talloc_free(msg_client_ctx);
talloc_free(msg_server_ctx);
talloc_free(ev);
return true;
}

View File

@ -1,47 +0,0 @@
/*
Unix SMB/CIFS implementation.
Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __ADM_H__
#define __ADM_H__
struct adm_file {
struct adm_class *classes;
};
struct adm_class {
struct adm_category *categories;
};
struct adm_category {
struct adm_category *subcategories;
struct adm_policy *policies;
};
struct adm_policy {
struct adm_part *parts;
};
struct adm_part {
int dummy;
};
struct adm_file *adm_read_file(const char *);
#endif /* __ADM_H__ */

View File

@ -1,14 +0,0 @@
[SUBSYSTEM::LIBPOLICY]
CFLAGS = -Iheimdal/lib/roken
PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG LIBTALLOC CHARSET
LIBPOLICY_OBJ_FILES = lib/policy/lex.o lib/policy/parse_adm.o
lib/policy/lex.l: lib/policy/parse_adm.h
lib/policy/parse_adm.h: lib/policy/parse_adm.c
[BINARY::dumpadm]
PRIVATE_DEPENDENCIES = LIBPOLICY LIBPOPT LIBSAMBA-HOSTCONFIG LIBTALLOC LIBSAMBA-UTIL CHARSET
dumpadm_OBJ_FILES = lib/policy/dumpadm.o

View File

@ -1,54 +0,0 @@
/*
Unix SMB/CIFS implementation.
Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "includes.h"
#include "lib/popt/popt.h"
#include "lib/policy/adm.h"
int main(int argc, char **argv)
{
bool ret = true;
poptContext pc;
struct poptOption long_options[] = {
POPT_AUTOHELP
{ 0, 0, 0, 0 }
};
pc = poptGetContext(argv[0], argc, (const char **)argv, long_options, 0);
poptSetOtherOptionHelp(pc, "<ADM-FILE> ...");
while ((poptGetNextOpt(pc) != -1))
if(!poptPeekArg(pc)) {
poptPrintUsage(pc, stderr, 0);
exit(1);
}
while (poptPeekArg(pc)) {
const char *name = poptGetArg(pc);
adm_read_file(name);
}
poptFreeContext(pc);
return ret;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,142 +0,0 @@
/*
Unix SMB/CIFS implementation.
Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
%{
#include "includes.h"
#include "lib/policy/parse_adm.h"
void error_message (const char *format, ...);
int yyparse (void);
static int lineno = 1;
static bool utf16 = false;
#define YY_INPUT(buf,result,max_size) \
{ \
if (utf16) { \
uint16_t v; \
if (fread(&v, 2, 1, yyin) < 1) \
result = YY_NULL; \
else \
result = push_codepoint(buf, v); \
} else { \
int c = getc(yyin); \
result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
} \
}
%}
%%
ACTIONLIST { return ACTIONLIST; }
CATEGORY { return CATEGORY; }
CHECKBOX { return CHECKBOX; }
CLASS { return CLASS; }
DELETE { return DEL; }
DEFAULT { return DEFAULT; }
DROPDOWNLIST { return DROPDOWNLIST; }
EDITTEXT { return EDITTEXT; }
END { return END; }
EXPLAIN { return EXPLAIN; }
ITEMLIST { return ITEMLIST; }
KEYNAME { return KEYNAME; }
MACHINE { return CLASS_MACHINE; }
MIN { return MINIMUM; }
MAX { return MAXIMUM; }
NAME { return NAME; }
NUMERIC { return NUMERIC; }
PART { return PART; }
POLICY { return POLICY; }
REQUIRED { return REQUIRED; }
SPIN { return SPIN; }
SUPPORTED { return SUPPORTED; }
TEXT { return TEXT; }
USER { return CLASS_USER; }
VALUE { return VALUE; }
VALUENAME { return VALUENAME; }
VALUEON { return VALUEON; }
VALUEOFF { return VALUEOFF; }
= { return EQUALS; }
\[strings\] { return STRINGSSECTION; }
[0-9]+ {
char *e, *y = yytext;
yylval.integer = strtol((const char *)yytext, &e, 0);
if(e == y)
error_message("malformed constant (%s)", yytext);
else
return INTEGER;
}
[A-Za-z\\{}][{}\-\\A-Za-z0-9_]* {
yylval.text = strdup ((const char *)yytext);
return LITERAL;
}
"!!"[A-Za-z][-A-Za-z0-9_]* {
yylval.text = strdup ((const char *)yytext);
return LOOKUPLITERAL;
}
[ \t]+
\n { lineno++; }
;[^\n]*\n { lineno++; }
\"([^\n]+)\n { lineno++; yylval.text = strdup((const char *)yytext); return LITERAL; }
%%
#ifndef yywrap /* XXX */
int
yywrap ()
{
return 1;
}
#endif
void
error_message (const char *format, ...)
{
va_list args;
va_start (args, format);
fprintf (stderr, "%d:", lineno);
vfprintf (stderr, format, args);
va_end (args);
}
struct adm_file *adm_read_file(const char *file)
{
uint8_t c[2];
yyin = fopen(file, "r");
if (yyin == NULL)
return NULL;
c[0] = getc(yyin);
c[1] = getc(yyin);
if (c[0] == 0xff && c[1] == 0xfe) {
utf16 = true;
} else {
rewind(yyin);
}
yyparse();
return NULL; /* FIXME */
}

File diff suppressed because it is too large Load Diff

View File

@ -1,135 +0,0 @@
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
CATEGORY = 258,
CLASS = 259,
CLASS_USER = 260,
CLASS_MACHINE = 261,
POLICY = 262,
KEYNAME = 263,
EXPLAIN = 264,
VALUENAME = 265,
VALUEON = 266,
VALUEOFF = 267,
PART = 268,
ITEMLIST = 269,
NAME = 270,
VALUE = 271,
NUMERIC = 272,
EDITTEXT = 273,
TEXT = 274,
DROPDOWNLIST = 275,
CHECKBOX = 276,
MINIMUM = 277,
MAXIMUM = 278,
DEFAULT = 279,
END = 280,
ACTIONLIST = 281,
DEL = 282,
SUPPORTED = 283,
LITERAL = 284,
INTEGER = 285,
LOOKUPLITERAL = 286,
CLIENTEXT = 287,
REQUIRED = 288,
NOSORT = 289,
SPIN = 290,
EQUALS = 291,
STRINGSSECTION = 292
};
#endif
/* Tokens. */
#define CATEGORY 258
#define CLASS 259
#define CLASS_USER 260
#define CLASS_MACHINE 261
#define POLICY 262
#define KEYNAME 263
#define EXPLAIN 264
#define VALUENAME 265
#define VALUEON 266
#define VALUEOFF 267
#define PART 268
#define ITEMLIST 269
#define NAME 270
#define VALUE 271
#define NUMERIC 272
#define EDITTEXT 273
#define TEXT 274
#define DROPDOWNLIST 275
#define CHECKBOX 276
#define MINIMUM 277
#define MAXIMUM 278
#define DEFAULT 279
#define END 280
#define ACTIONLIST 281
#define DEL 282
#define SUPPORTED 283
#define LITERAL 284
#define INTEGER 285
#define LOOKUPLITERAL 286
#define CLIENTEXT 287
#define REQUIRED 288
#define NOSORT 289
#define SPIN 290
#define EQUALS 291
#define STRINGSSECTION 292
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 33 "lib/policy/parse_adm.y"
{
char *text;
int integer;
}
/* Line 1489 of yacc.c. */
#line 128 "lib/policy/parse_adm.y"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE yylval;

View File

@ -1,138 +0,0 @@
/*
Unix SMB/CIFS implementation.
Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
For more information on the .ADM file format:
http://msdn2.microsoft.com/en-us/library/aa372405.aspx
*/
%{
#include "config.h"
void error_message (const char *format, ...);
int yyparse (void);
void yyerror (const char *s);
extern int yylex (void);
%}
%union {
char *text;
int integer;
}
%token CATEGORY
%token CLASS
%token CLASS_USER
%token CLASS_MACHINE
%token POLICY
%token KEYNAME
%token EXPLAIN
%token VALUENAME
%token VALUEON VALUEOFF
%token PART
%token ITEMLIST
%token NAME
%token VALUE
%token NUMERIC EDITTEXT TEXT DROPDOWNLIST CHECKBOX
%token MINIMUM MAXIMUM DEFAULT
%token END
%token ACTIONLIST
%token DEL
%token SUPPORTED
%token <text> LITERAL
%token <integer> INTEGER
%token <text> LOOKUPLITERAL
%token CLIENTEXT
%token REQUIRED
%token NOSORT
%token SPIN
%token EQUALS
%token STRINGSSECTION
%start admfile
%%
admfile: classes strings;
classes: /* empty */ | class classes;
class: CLASS classvalue categories;
classvalue: CLASS_USER|CLASS_MACHINE;
categories: /* empty */ | category categories;
string: LITERAL | LOOKUPLITERAL;
category: CATEGORY string categoryitems END CATEGORY;
categoryitem: explain | category | policy | keyname;
categoryitems: categoryitem categoryitems | /* empty */ ;
policy: POLICY string policyitems END POLICY;
policyitem: explain | keyname | valuename | valueon | valueoff | min | max | defaultvalue | supported | part;
policyitems: policyitem policyitems | /* empty */;
valuetype: NUMERIC | EDITTEXT | TEXT | DROPDOWNLIST | CHECKBOX;
part: PART string valuetype partitems END PART;
spin: SPIN INTEGER;
partitem: keyname | valuename | valueon | valueoff | min | max | defaultvalue | itemlist | REQUIRED | spin;
partitems: partitem partitems | /* empty */;
min: MINIMUM INTEGER;
max: MAXIMUM INTEGER;
defaultvalue: DEFAULT INTEGER;
explain: EXPLAIN string;
value: DEL | NUMERIC INTEGER;
valueon: VALUEON value;
valueoff: VALUEOFF value;
valuename: VALUENAME string;
keyname: KEYNAME string;
itemlist: ITEMLIST items END ITEMLIST;
itemname: NAME string;
itemvalue: VALUE value;
item: itemname | itemvalue | DEFAULT | actionlist;
items: /* empty */ | item items;
supported: SUPPORTED string;
actionlist: ACTIONLIST actions END ACTIONLIST;
actions: valuename actions | itemvalue actions | /* empty */;
variable: LITERAL EQUALS LITERAL;
variables: variable variables | /* empty */;
strings: STRINGSSECTION variables;
%%
void
yyerror (const char *s)
{
error_message ("%s\n", s);
}

View File

@ -28,6 +28,7 @@
_PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **root)
{
@ -57,7 +58,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
} else if (!strncmp(peek, "TDB file", 8)) {
close(fd);
return reg_open_ldb_file(parent_ctx, location, session_info,
credentials, lp_ctx, root);
credentials, ev_ctx, lp_ctx, root);
}
return WERR_BADFILE;

View File

@ -357,6 +357,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h,
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **k)
{
@ -367,7 +368,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
if (location == NULL)
return WERR_INVALID_PARAM;
wrap = ldb_wrap_connect(parent_ctx, lp_ctx,
wrap = ldb_wrap_connect(parent_ctx, ev_ctx, lp_ctx,
location, session_info, credentials, 0, NULL);
if (wrap == NULL) {

View File

@ -36,9 +36,6 @@ struct registry_local {
struct hive_key *key;
struct mountpoint *prev, *next;
} *mountpoints;
struct auth_session_info *session_info;
struct cli_credentials *credentials;
};
struct local_key {
@ -293,9 +290,7 @@ const static struct registry_operations local_ops = {
.get_key_info = local_get_key_info,
};
WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials)
WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx)
{
struct registry_local *ret = talloc_zero(mem_ctx,
struct registry_local);
@ -303,8 +298,6 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx,
W_ERROR_HAVE_NO_MEMORY(ret);
ret->ops = &local_ops;
ret->session_info = session_info;
ret->credentials = credentials;
*ctx = (struct registry_context *)ret;

View File

@ -149,10 +149,12 @@ struct hive_operations {
struct cli_credentials;
struct auth_session_info;
struct event_context;
WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **root);
WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key,
@ -199,6 +201,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **k);
@ -355,12 +358,11 @@ struct loadparm_context;
* Open the locally defined registry.
*/
WERROR reg_open_local(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials);
struct registry_context **ctx);
WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials);

View File

@ -26,6 +26,7 @@
#include "includes.h"
#include "registry.h"
#include "param/param.h"
#include "events/events.h"
typedef struct registry_context reg;
typedef struct hive_key hive_key;
@ -41,6 +42,7 @@ typedef struct hive_key hive_key;
%import "../../auth/credentials/credentials.i"
%import "../../libcli/util/errors.i"
%import "../../param/param.i"
%import "../events/events.i"
/* Utility functions */
@ -57,9 +59,7 @@ const char *str_regtype(int type);
}
%rename(Registry) reg_open_local;
WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials);
WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx);
%typemap(in,noblock=1) const char ** {
/* Check if is a list */
@ -134,6 +134,7 @@ typedef struct registry_context {
WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **root);
@ -141,6 +142,7 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
struct auth_session_info *session_info,
struct cli_credentials *credentials,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct hive_key **k);
@ -167,6 +169,7 @@ typedef struct hive_key {
WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials);

View File

@ -1,5 +1,5 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.33
# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
@ -59,6 +59,7 @@ def _swig_setattr_nondynamic_method(set):
import credentials
import param
import events
reg_get_predef_name = _registry.reg_get_predef_name
str_regtype = _registry.str_regtype
Registry = _registry.Registry

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 1.3.33
* Version 1.3.35
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@ -126,7 +126,7 @@
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "3"
#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
@ -161,6 +161,7 @@
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
extern "C" {
#endif
typedef void *(*swig_converter_func)(void *);
typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
/* Structure to store inforomation on one type */
/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
Py_DECREF(old_str);
Py_DECREF(value);
} else {
PyErr_Format(PyExc_RuntimeError, mesg);
PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
{
PySwigObject *sobj = (PySwigObject *) v;
PyObject *next = sobj->next;
if (sobj->own) {
if (sobj->own == SWIG_POINTER_OWN) {
swig_type_info *ty = sobj->ty;
PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
res = ((*meth)(mself, v));
}
Py_XDECREF(res);
} else {
const char *name = SWIG_TypePrettyName(ty);
}
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
#endif
else {
const char *name = SWIG_TypePrettyName(ty);
printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
#endif
}
Py_XDECREF(next);
PyObject_DEL(v);
@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
if (own) {
if (own == SWIG_POINTER_OWN) {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
return SWIG_OK;
} else {
PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
if (own)
*own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
if (!tc) {
sobj = (PySwigObject *)sobj->next;
} else {
if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
if (ptr) {
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
if (newmemory == SWIG_CAST_NEW_MEMORY) {
assert(own);
if (own)
*own = *own | SWIG_CAST_NEW_MEMORY;
}
}
break;
}
}
@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
}
}
if (sobj) {
if (own) *own = sobj->own;
if (own)
*own = *own | sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
}
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
if (!tc) return SWIG_ERROR;
*ptr = SWIG_TypeCast(tc,vptr);
if (tc) {
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
} else {
return SWIG_ERROR;
}
} else {
*ptr = vptr;
}
@ -2460,29 +2478,30 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
#define SWIGTYPE_p_auth_session_info swig_types[1]
#define SWIGTYPE_p_char swig_types[2]
#define SWIGTYPE_p_cli_credentials swig_types[3]
#define SWIGTYPE_p_hive_key swig_types[4]
#define SWIGTYPE_p_int swig_types[5]
#define SWIGTYPE_p_loadparm_context swig_types[6]
#define SWIGTYPE_p_loadparm_service swig_types[7]
#define SWIGTYPE_p_long_long swig_types[8]
#define SWIGTYPE_p_p_char swig_types[9]
#define SWIGTYPE_p_p_hive_key swig_types[10]
#define SWIGTYPE_p_p_registry_context swig_types[11]
#define SWIGTYPE_p_p_registry_key swig_types[12]
#define SWIGTYPE_p_param_context swig_types[13]
#define SWIGTYPE_p_param_opt swig_types[14]
#define SWIGTYPE_p_param_section swig_types[15]
#define SWIGTYPE_p_reg_diff_callbacks swig_types[16]
#define SWIGTYPE_p_registry_context swig_types[17]
#define SWIGTYPE_p_registry_key swig_types[18]
#define SWIGTYPE_p_short swig_types[19]
#define SWIGTYPE_p_signed_char swig_types[20]
#define SWIGTYPE_p_unsigned_char swig_types[21]
#define SWIGTYPE_p_unsigned_int swig_types[22]
#define SWIGTYPE_p_unsigned_long_long swig_types[23]
#define SWIGTYPE_p_unsigned_short swig_types[24]
static swig_type_info *swig_types[26];
static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
#define SWIGTYPE_p_event_context swig_types[4]
#define SWIGTYPE_p_hive_key swig_types[5]
#define SWIGTYPE_p_int swig_types[6]
#define SWIGTYPE_p_loadparm_context swig_types[7]
#define SWIGTYPE_p_loadparm_service swig_types[8]
#define SWIGTYPE_p_long_long swig_types[9]
#define SWIGTYPE_p_p_char swig_types[10]
#define SWIGTYPE_p_p_hive_key swig_types[11]
#define SWIGTYPE_p_p_registry_context swig_types[12]
#define SWIGTYPE_p_p_registry_key swig_types[13]
#define SWIGTYPE_p_param_context swig_types[14]
#define SWIGTYPE_p_param_opt swig_types[15]
#define SWIGTYPE_p_param_section swig_types[16]
#define SWIGTYPE_p_reg_diff_callbacks swig_types[17]
#define SWIGTYPE_p_registry_context swig_types[18]
#define SWIGTYPE_p_registry_key swig_types[19]
#define SWIGTYPE_p_short swig_types[20]
#define SWIGTYPE_p_signed_char swig_types[21]
#define SWIGTYPE_p_unsigned_char swig_types[22]
#define SWIGTYPE_p_unsigned_int swig_types[23]
#define SWIGTYPE_p_unsigned_long_long swig_types[24]
#define SWIGTYPE_p_unsigned_short swig_types[25]
static swig_type_info *swig_types[27];
static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@ -2514,7 +2533,7 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
#define SWIG_name "_registry"
#define SWIGVERSION 0x010333
#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
@ -2529,6 +2548,7 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
#include "includes.h"
#include "registry.h"
#include "param/param.h"
#include "events/events.h"
typedef struct registry_context reg;
typedef struct hive_key hive_key;
@ -2910,44 +2930,17 @@ fail:
}
SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
struct registry_context **arg2 = (struct registry_context **) 0 ;
struct auth_session_info *arg3 = (struct auth_session_info *) 0 ;
struct cli_credentials *arg4 = (struct cli_credentials *) 0 ;
WERROR result;
struct registry_context *tmp2 ;
void *argp3 = 0 ;
int res3 = 0 ;
void *argp4 = 0 ;
int res4 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
char * kwnames[] = {
(char *) "session_info",(char *) "credentials", NULL
};
arg3 = NULL;
arg4 = NULL;
arg1 = NULL;
arg2 = &tmp2;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Registry",kwnames,&obj0,&obj1)) SWIG_fail;
if (obj0) {
res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_auth_session_info, 0 | 0 );
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Registry" "', argument " "3"" of type '" "struct auth_session_info *""'");
}
arg3 = (struct auth_session_info *)(argp3);
}
if (obj1) {
res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_cli_credentials, 0 | 0 );
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Registry" "', argument " "4"" of type '" "struct cli_credentials *""'");
}
arg4 = (struct cli_credentials *)(argp4);
}
result = reg_open_local(arg1,arg2,arg3,arg4);
if (!SWIG_Python_UnpackTuple(args,"Registry",0,0,0)) SWIG_fail;
result = reg_open_local(arg1,arg2);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
@ -3410,7 +3403,10 @@ check_1:
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'reg_mount_hive'.\n Possible C/C++ prototypes are:\n"" mount_hive(reg *,struct hive_key *,uint32_t,char const **)\n"" mount_hive(reg *,struct hive_key *,char const *)\n");
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'reg_mount_hive'.\n"
" Possible C/C++ prototypes are:\n"
" mount_hive(reg *,struct hive_key *,uint32_t,char const **)\n"
" mount_hive(reg *,struct hive_key *,char const *)\n");
return NULL;
}
@ -3420,7 +3416,7 @@ SWIGINTERN PyObject *_wrap_new_reg(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
reg *result = 0 ;
if (!SWIG_Python_UnpackTuple(args,"new_reg",0,0,0)) SWIG_fail;
result = (reg *)(reg *) calloc(1, sizeof(reg));
result = (reg *)calloc(1, sizeof(reg));
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_registry_context, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
@ -3468,8 +3464,9 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
char *arg2 = (char *) 0 ;
struct auth_session_info *arg3 = (struct auth_session_info *) 0 ;
struct cli_credentials *arg4 = (struct cli_credentials *) 0 ;
struct loadparm_context *arg5 = (struct loadparm_context *) 0 ;
struct hive_key **arg6 = (struct hive_key **) 0 ;
struct event_context *arg5 = (struct event_context *) 0 ;
struct loadparm_context *arg6 = (struct loadparm_context *) 0 ;
struct hive_key **arg7 = (struct hive_key **) 0 ;
WERROR result;
int res2 ;
char *buf2 = 0 ;
@ -3480,21 +3477,25 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
int res4 = 0 ;
void *argp5 = 0 ;
int res5 = 0 ;
struct hive_key *tmp6 ;
void *argp6 = 0 ;
int res6 = 0 ;
struct hive_key *tmp7 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
PyObject * obj4 = 0 ;
char * kwnames[] = {
(char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL
(char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL
};
arg3 = NULL;
arg4 = NULL;
arg5 = loadparm_init(NULL);
arg5 = event_context_init(NULL);
arg6 = loadparm_init(NULL);
arg1 = NULL;
arg6 = &tmp6;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
arg7 = &tmp7;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "hive_key" "', argument " "2"" of type '" "char const *""'");
@ -3515,13 +3516,20 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
arg4 = (struct cli_credentials *)(argp4);
}
if (obj3) {
res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 );
res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 );
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct loadparm_context *""'");
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct event_context *""'");
}
arg5 = (struct loadparm_context *)(argp5);
arg5 = (struct event_context *)(argp5);
}
result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
if (obj4) {
res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 | 0 );
if (!SWIG_IsOK(res6)) {
SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "hive_key" "', argument " "6"" of type '" "struct loadparm_context *""'");
}
arg6 = (struct loadparm_context *)(argp6);
}
result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
@ -3530,7 +3538,7 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
resultobj = Py_None;
}
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0);
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@ -3545,8 +3553,9 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
char *arg2 = (char *) 0 ;
struct auth_session_info *arg3 = (struct auth_session_info *) 0 ;
struct cli_credentials *arg4 = (struct cli_credentials *) 0 ;
struct loadparm_context *arg5 = (struct loadparm_context *) 0 ;
struct hive_key **arg6 = (struct hive_key **) 0 ;
struct event_context *arg5 = (struct event_context *) 0 ;
struct loadparm_context *arg6 = (struct loadparm_context *) 0 ;
struct hive_key **arg7 = (struct hive_key **) 0 ;
WERROR result;
int res2 ;
char *buf2 = 0 ;
@ -3557,21 +3566,25 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
int res4 = 0 ;
void *argp5 = 0 ;
int res5 = 0 ;
struct hive_key *tmp6 ;
void *argp6 = 0 ;
int res6 = 0 ;
struct hive_key *tmp7 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
PyObject * obj4 = 0 ;
char * kwnames[] = {
(char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL
(char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL
};
arg3 = NULL;
arg4 = NULL;
arg5 = loadparm_init(NULL);
arg5 = event_context_init(NULL);
arg6 = loadparm_init(NULL);
arg1 = NULL;
arg6 = &tmp6;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
arg7 = &tmp7;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "open_ldb" "', argument " "2"" of type '" "char const *""'");
@ -3592,13 +3605,20 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
arg4 = (struct cli_credentials *)(argp4);
}
if (obj3) {
res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 | 0 );
res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 );
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct loadparm_context *""'");
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct event_context *""'");
}
arg5 = (struct loadparm_context *)(argp5);
arg5 = (struct event_context *)(argp5);
}
result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
if (obj4) {
res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 | 0 );
if (!SWIG_IsOK(res6)) {
SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_ldb" "', argument " "6"" of type '" "struct loadparm_context *""'");
}
arg6 = (struct loadparm_context *)(argp6);
}
result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
@ -3607,7 +3627,7 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
resultobj = Py_None;
}
Py_XDECREF(resultobj);
resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0);
if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
return resultobj;
fail:
@ -3702,9 +3722,10 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *
PyObject *resultobj = 0;
TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
struct registry_context **arg2 = (struct registry_context **) 0 ;
struct loadparm_context *arg3 = (struct loadparm_context *) 0 ;
struct auth_session_info *arg4 = (struct auth_session_info *) 0 ;
struct cli_credentials *arg5 = (struct cli_credentials *) 0 ;
struct event_context *arg3 = (struct event_context *) 0 ;
struct loadparm_context *arg4 = (struct loadparm_context *) 0 ;
struct auth_session_info *arg5 = (struct auth_session_info *) 0 ;
struct cli_credentials *arg6 = (struct cli_credentials *) 0 ;
WERROR result;
struct registry_context *tmp2 ;
void *argp3 = 0 ;
@ -3713,41 +3734,52 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *
int res4 = 0 ;
void *argp5 = 0 ;
int res5 = 0 ;
void *argp6 = 0 ;
int res6 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
char * kwnames[] = {
(char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL
(char *) "ev_ctx",(char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL
};
arg3 = loadparm_init(NULL);
arg4 = NULL;
arg3 = event_context_init(NULL);
arg4 = loadparm_init(NULL);
arg5 = NULL;
arg6 = NULL;
arg1 = NULL;
arg2 = &tmp2;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:open_samba",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOO:open_samba",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
if (obj0) {
res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_loadparm_context, 0 | 0 );
res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_event_context, 0 | 0 );
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct loadparm_context *""'");
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct event_context *""'");
}
arg3 = (struct loadparm_context *)(argp3);
arg3 = (struct event_context *)(argp3);
}
if (obj1) {
res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_auth_session_info, 0 | 0 );
res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_loadparm_context, 0 | 0 );
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct auth_session_info *""'");
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct loadparm_context *""'");
}
arg4 = (struct auth_session_info *)(argp4);
arg4 = (struct loadparm_context *)(argp4);
}
if (obj2) {
res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_cli_credentials, 0 | 0 );
res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_auth_session_info, 0 | 0 );
if (!SWIG_IsOK(res5)) {
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct cli_credentials *""'");
SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct auth_session_info *""'");
}
arg5 = (struct cli_credentials *)(argp5);
arg5 = (struct auth_session_info *)(argp5);
}
result = reg_open_samba(arg1,arg2,arg3,arg4,arg5);
if (obj3) {
res6 = SWIG_ConvertPtr(obj3, &argp6,SWIGTYPE_p_cli_credentials, 0 | 0 );
if (!SWIG_IsOK(res6)) {
SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_samba" "', argument " "6"" of type '" "struct cli_credentials *""'");
}
arg6 = (struct cli_credentials *)(argp6);
}
result = reg_open_samba(arg1,arg2,arg3,arg4,arg5,arg6);
if (!W_ERROR_IS_OK(result)) {
PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
PyErr_SetObject(PyExc_RuntimeError, obj);
@ -3765,7 +3797,7 @@ fail:
static PyMethodDef SwigMethods[] = {
{ (char *)"reg_get_predef_name", (PyCFunction) _wrap_reg_get_predef_name, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"str_regtype", (PyCFunction) _wrap_str_regtype, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Registry", (PyCFunction) _wrap_Registry, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"Registry", (PyCFunction)_wrap_Registry, METH_NOARGS, NULL},
{ (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"reg_key_del_abs", (PyCFunction) _wrap_reg_key_del_abs, METH_VARARGS | METH_KEYWORDS, NULL},
{ (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, NULL},
@ -3792,6 +3824,7 @@ static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0
static swig_type_info _swigt__p_auth_session_info = {"_p_auth_session_info", "struct auth_session_info *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_hive_key = {"_p_hive_key", "struct hive_key *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0};
@ -3819,6 +3852,7 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_auth_session_info,
&_swigt__p_char,
&_swigt__p_cli_credentials,
&_swigt__p_event_context,
&_swigt__p_hive_key,
&_swigt__p_int,
&_swigt__p_loadparm_context,
@ -3846,6 +3880,7 @@ static swig_cast_info _swigc__p_TALLOC_CTX[] = { {&_swigt__p_TALLOC_CTX, 0, 0,
static swig_cast_info _swigc__p_auth_session_info[] = { {&_swigt__p_auth_session_info, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_cli_credentials[] = { {&_swigt__p_cli_credentials, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_event_context[] = { {&_swigt__p_event_context, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_hive_key[] = { {&_swigt__p_hive_key, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_loadparm_context[] = { {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}};
@ -3873,6 +3908,7 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_auth_session_info,
_swigc__p_char,
_swigc__p_cli_credentials,
_swigc__p_event_context,
_swigc__p_hive_key,
_swigc__p_int,
_swigc__p_loadparm_context,
@ -3962,7 +3998,7 @@ SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
size_t i;
swig_module_info *module_head, *iter;
int found;
int found, init;
clientdata = clientdata;
@ -3972,6 +4008,9 @@ SWIG_InitializeModule(void *clientdata) {
swig_module.type_initial = swig_type_initial;
swig_module.cast_initial = swig_cast_initial;
swig_module.next = &swig_module;
init = 1;
} else {
init = 0;
}
/* Try and load any already created modules */
@ -4000,6 +4039,12 @@ SWIG_InitializeModule(void *clientdata) {
module_head->next = &swig_module;
}
/* When multiple interpeters are used, a module could have already been initialized in
a different interpreter, but not yet have a pointer in this interpreter.
In this case, we do not want to continue adding types... everything should be
set up already */
if (init == 0) return;
/* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
printf("SWIG_InitializeModule: size %d\n", swig_module.size);

View File

@ -26,6 +26,7 @@
*/
static WERROR mount_samba_hive(struct registry_context *ctx,
struct event_context *event_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *auth_info,
struct cli_credentials *creds,
@ -40,11 +41,11 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
lp_private_dir(lp_ctx),
name);
error = reg_open_hive(ctx, location, auth_info, creds, lp_ctx, &hive);
error = reg_open_hive(ctx, location, auth_info, creds, event_ctx, lp_ctx, &hive);
if (W_ERROR_EQUAL(error, WERR_BADFILE))
error = reg_open_ldb_file(ctx, location, auth_info,
creds, lp_ctx, &hive);
creds, event_ctx, lp_ctx, &hive);
if (!W_ERROR_IS_OK(error))
return error;
@ -55,29 +56,30 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
_PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
struct registry_context **ctx,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct auth_session_info *session_info,
struct cli_credentials *credentials)
{
WERROR result;
result = reg_open_local(mem_ctx, ctx, session_info, credentials);
result = reg_open_local(mem_ctx, ctx);
if (!W_ERROR_IS_OK(result)) {
return result;
}
mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
"hklm", HKEY_LOCAL_MACHINE);
mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
"hkcr", HKEY_CLASSES_ROOT);
/* FIXME: Should be mounted from NTUSER.DAT in the home directory of the
* current user */
mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
"hkcu", HKEY_CURRENT_USER);
mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
"hku", HKEY_USERS);
/* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes

View File

@ -68,14 +68,15 @@ static bool test_keyinfo_nums(struct torture_context *tctx, void *test_data)
struct hive_key *root = (struct hive_key *)test_data;
WERROR error;
struct hive_key *subkey;
uint32_t data = 42;
char data[4];
SIVAL(data, 0, 42);
error = hive_key_add_name(tctx, root, "Nested Keyll", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_key_set_value(root, "Answer", REG_DWORD,
data_blob_talloc(tctx, &data, sizeof(data)));
data_blob_talloc(tctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
/* This is a new backend. There should be no subkeys and no
@ -119,7 +120,8 @@ static bool test_del_recursive(struct torture_context *tctx,
struct hive_key *subkey2;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
uint32_t data = 42;
char data[4];
SIVAL(data, 0, 42);
/* Create a new key under the root */
error = hive_key_add_name(mem_ctx, root, "Parent Key", NULL,
@ -133,7 +135,7 @@ static bool test_del_recursive(struct torture_context *tctx,
/* Create a new value under "Child Key" */
error = hive_key_set_value(subkey2, "Answer Recursive", REG_DWORD,
data_blob_talloc(mem_ctx, &data, sizeof(data)));
data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
/* Deleting "Parent Key" will also delete "Child Key" and the value. */
@ -179,14 +181,15 @@ static bool test_set_value(struct torture_context *tctx,
struct hive_key *subkey;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
uint32_t data = 42;
char data[4];
SIVAL(data, 0, 42);
error = hive_key_add_name(mem_ctx, root, "YA Nested Key", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
data_blob_talloc(mem_ctx, &data, sizeof(data)));
data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
return true;
@ -198,10 +201,12 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
struct hive_key *subkey;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
uint32_t data = 42;
char data[4];
uint32_t type;
DATA_BLOB value;
SIVAL(data, 0, 42);
error = hive_key_add_name(mem_ctx, root, "EYA Nested Key", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
@ -211,7 +216,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
"getting missing value");
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
data_blob_talloc(mem_ctx, &data, sizeof(data)));
data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value);
@ -220,7 +225,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
torture_assert_int_equal(tctx, value.length, 4, "value length");
torture_assert_int_equal(tctx, type, REG_DWORD, "value type");
torture_assert_int_equal(tctx, data, IVAL(value.data, 0),
torture_assert_mem_equal(tctx, &data, value.data, sizeof(uint32_t),
"value data");
return true;
@ -232,16 +237,18 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data)
struct hive_key *subkey;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
uint32_t data = 42;
char data[4];
uint32_t type;
DATA_BLOB value;
SIVAL(data, 0, 42);
error = hive_key_add_name(mem_ctx, root, "EEYA Nested Key", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
data_blob_talloc(mem_ctx, &data, sizeof(data)));
data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
error = hive_key_del_value(subkey, "Answer");
@ -264,17 +271,19 @@ static bool test_list_values(struct torture_context *tctx,
struct hive_key *subkey;
const struct hive_key *root = (const struct hive_key *)test_data;
TALLOC_CTX *mem_ctx = tctx;
uint32_t data = 42;
char data[4];
uint32_t type;
DATA_BLOB value;
const char *name;
int data_val = 42;
SIVAL(data, 0, data_val);
error = hive_key_add_name(mem_ctx, root, "AYAYA Nested Key", NULL,
NULL, &subkey);
torture_assert_werr_ok(tctx, error, "hive_key_add_name");
error = hive_key_set_value(subkey, "Answer", REG_DWORD,
data_blob_talloc(mem_ctx, &data, sizeof(data)));
data_blob_talloc(mem_ctx, data, sizeof(data)));
torture_assert_werr_ok(tctx, error, "hive_key_set_value");
error = hive_get_value_by_index(mem_ctx, subkey, 0, &name,
@ -287,7 +296,7 @@ static bool test_list_values(struct torture_context *tctx,
torture_assert_int_equal(tctx, type, REG_DWORD, "value type");
torture_assert_int_equal(tctx, data, IVAL(value.data, 0), "value data");
torture_assert_int_equal(tctx, data_val, IVAL(value.data, 0), "value data");
error = hive_get_value_by_index(mem_ctx, subkey, 1, &name,
&type, &value);
@ -363,7 +372,7 @@ static bool hive_setup_ldb(struct torture_context *tctx, void **data)
rmdir(dirname);
error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->lp_ctx, &key);
error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->ev, tctx->lp_ctx, &key);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to initialize ldb hive\n");
return false;

View File

@ -281,7 +281,8 @@ static bool test_query_key_nums(struct torture_context *tctx, void *_data)
struct registry_key *root, *subkey1, *subkey2;
WERROR error;
uint32_t num_subkeys, num_values;
uint32_t data = 42;
char data[4];
SIVAL(data, 0, 42);
if (!create_test_key(tctx, rctx, "Berlin", &root, &subkey1))
return false;
@ -353,13 +354,15 @@ static bool test_set_value(struct torture_context *tctx, void *_data)
struct registry_context *rctx = (struct registry_context *)_data;
struct registry_key *subkey = NULL, *root;
WERROR error;
uint32_t data = 42;
char data[4];
SIVAL(data, 0, 42);
if (!create_test_key(tctx, rctx, "Dusseldorf", &root, &subkey))
return false;
error = reg_val_set(subkey, "Answer", REG_DWORD,
data_blob_talloc(tctx, &data, sizeof(data)));
data_blob_talloc(tctx, data, sizeof(data)));
torture_assert_werr_ok (tctx, error, "setting value");
return true;
@ -408,8 +411,9 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
struct registry_key *subkey = NULL, *root;
WERROR error;
DATA_BLOB data;
uint32_t value = 42;
char value[4];
uint32_t type;
SIVAL(value, 0, 42);
if (!create_test_key(tctx, rctx, "Duisburg", &root, &subkey))
return false;
@ -420,16 +424,16 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
"getting missing value");
error = reg_val_set(subkey, __FUNCTION__, REG_DWORD,
data_blob_talloc(tctx, &value, 4));
data_blob_talloc(tctx, value, sizeof(value)));
torture_assert_werr_ok(tctx, error, "setting value");
error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type,
&data);
torture_assert_werr_ok(tctx, error, "getting value");
torture_assert_int_equal(tctx, 4, data.length, "value length ok");
torture_assert(tctx, memcmp(data.data, &value, 4) == 0,
"value content ok");
torture_assert_int_equal(tctx, sizeof(value), data.length, "value length ok");
torture_assert_mem_equal(tctx, data.data, value, sizeof(value),
"value content ok");
torture_assert_int_equal(tctx, REG_DWORD, type, "value type");
return true;
@ -444,8 +448,9 @@ static bool test_del_value(struct torture_context *tctx, void *_data)
struct registry_key *subkey = NULL, *root;
WERROR error;
DATA_BLOB data;
uint32_t value = 42;
uint32_t type;
char value[4];
SIVAL(value, 0, 42);
if (!create_test_key(tctx, rctx, "Warschau", &root, &subkey))
return false;
@ -456,7 +461,7 @@ static bool test_del_value(struct torture_context *tctx, void *_data)
"getting missing value");
error = reg_val_set(subkey, __FUNCTION__, REG_DWORD,
data_blob_talloc(tctx, &value, 4));
data_blob_talloc(tctx, value, sizeof(value)));
torture_assert_werr_ok (tctx, error, "setting value");
error = reg_del_value(subkey, __FUNCTION__);
@ -479,15 +484,16 @@ static bool test_list_values(struct torture_context *tctx, void *_data)
struct registry_key *subkey = NULL, *root;
WERROR error;
DATA_BLOB data;
uint32_t value = 42;
uint32_t type;
const char *name;
char value[4];
SIVAL(value, 0, 42);
if (!create_test_key(tctx, rctx, "Bonn", &root, &subkey))
return false;
error = reg_val_set(subkey, "bar", REG_DWORD,
data_blob_talloc(tctx, &value, 4));
data_blob_talloc(tctx, value, sizeof(value)));
torture_assert_werr_ok (tctx, error, "setting value");
error = reg_key_get_value_by_index(tctx, subkey, 0, &name,
@ -495,8 +501,8 @@ static bool test_list_values(struct torture_context *tctx, void *_data)
torture_assert_werr_ok(tctx, error, "getting value");
torture_assert_str_equal(tctx, name, "bar", "value name");
torture_assert_int_equal(tctx, 4, data.length, "value length");
torture_assert(tctx, memcmp(data.data, &value, 4) == 0,
torture_assert_int_equal(tctx, sizeof(value), data.length, "value length");
torture_assert_mem_equal(tctx, data.data, value, sizeof(value),
"value content");
torture_assert_int_equal(tctx, REG_DWORD, type, "value type");
@ -517,14 +523,14 @@ static bool setup_local_registry(struct torture_context *tctx, void **data)
struct hive_key *hive_key;
const char *filename;
error = reg_open_local(tctx, &rctx, NULL, NULL);
error = reg_open_local(tctx, &rctx);
torture_assert_werr_ok(tctx, error, "Opening local registry failed");
status = torture_temp_dir(tctx, "registry-local", &tempdir);
torture_assert_ntstatus_ok(tctx, status, "Creating temp dir failed");
filename = talloc_asprintf(tctx, "%s/classes_root.ldb", tempdir);
error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &hive_key);
error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &hive_key);
torture_assert_werr_ok(tctx, error, "Opening classes_root file failed");
error = reg_mount_hive(rctx, hive_key, HKEY_CLASSES_ROOT, NULL);

View File

@ -42,6 +42,7 @@ struct registry_context *reg_common_open_remote(const char *remote,
}
struct registry_key *reg_common_open_file(const char *path,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
struct cli_credentials *creds)
{
@ -49,7 +50,7 @@ struct registry_key *reg_common_open_file(const char *path,
struct registry_context *h = NULL;
WERROR error;
error = reg_open_hive(NULL, path, NULL, creds, lp_ctx, &hive_root);
error = reg_open_hive(NULL, path, NULL, creds, ev_ctx, lp_ctx, &hive_root);
if(!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to open '%s': %s \n",
@ -57,7 +58,7 @@ struct registry_key *reg_common_open_file(const char *path,
return NULL;
}
error = reg_open_local(NULL, &h, NULL, creds);
error = reg_open_local(NULL, &h);
if (!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to initialize local registry: %s\n",
win_errstr(error));
@ -67,12 +68,14 @@ struct registry_key *reg_common_open_file(const char *path,
return reg_import_hive_key(h, hive_root, -1, NULL);
}
struct registry_context *reg_common_open_local(struct cli_credentials *creds, struct loadparm_context *lp_ctx)
struct registry_context *reg_common_open_local(struct cli_credentials *creds,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx)
{
WERROR error;
struct registry_context *h = NULL;
error = reg_open_samba(NULL, &h, lp_ctx, NULL, creds);
error = reg_open_samba(NULL, &h, ev_ctx, lp_ctx, NULL, creds);
if(!W_ERROR_IS_OK(error)) {
fprintf(stderr, "Unable to open local registry:%s \n",

View File

@ -29,6 +29,7 @@
enum reg_backend { REG_UNKNOWN, REG_LOCAL, REG_REMOTE, REG_NULL };
static struct registry_context *open_backend(poptContext pc,
struct event_context *ev_ctx,
struct loadparm_context *lp_ctx,
enum reg_backend backend,
const char *remote_host)
@ -41,14 +42,14 @@ static struct registry_context *open_backend(poptContext pc,
poptPrintUsage(pc, stderr, 0);
return NULL;
case REG_LOCAL:
error = reg_open_samba(NULL, &ctx, lp_ctx, NULL, cmdline_credentials);
error = reg_open_samba(NULL, &ctx, ev_ctx, lp_ctx, NULL, cmdline_credentials);
break;
case REG_REMOTE:
error = reg_open_remote(&ctx, NULL, cmdline_credentials, lp_ctx,
remote_host, NULL);
break;
case REG_NULL:
error = reg_open_local(NULL, &ctx, NULL, cmdline_credentials);
error = reg_open_local(NULL, &ctx);
break;
}
@ -82,6 +83,7 @@ int main(int argc, const char **argv)
};
TALLOC_CTX *ctx;
void *callback_data;
struct event_context *ev_ctx;
struct reg_diff_callbacks *callbacks;
ctx = talloc_init("regdiff");
@ -116,11 +118,13 @@ int main(int argc, const char **argv)
}
h1 = open_backend(pc, cmdline_lp_ctx, backend1, remote1);
ev_ctx = event_context_init(NULL);
h1 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend1, remote1);
if (h1 == NULL)
return 1;
h2 = open_backend(pc, cmdline_lp_ctx, backend2, remote2);
h2 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend2, remote2);
if (h2 == NULL)
return 1;

View File

@ -24,6 +24,7 @@
#include "lib/cmdline/popt_common.h"
#include "lib/registry/tools/common.h"
#include "param/param.h"
#include "events/events.h"
int main(int argc, char **argv)
{
@ -33,6 +34,7 @@ int main(int argc, char **argv)
struct registry_context *h;
const char *file = NULL;
const char *remote = NULL;
struct event_context *ev;
struct poptOption long_options[] = {
POPT_AUTOHELP
{"remote", 'R', POPT_ARG_STRING, &remote, 0, "connect to specified remote server", NULL},
@ -47,10 +49,12 @@ int main(int argc, char **argv)
while((opt = poptGetNextOpt(pc)) != -1) {
}
ev = event_context_init(NULL);
if (remote) {
h = reg_common_open_remote (remote, cmdline_lp_ctx, cmdline_credentials);
} else {
h = reg_common_open_local (cmdline_credentials, cmdline_lp_ctx);
h = reg_common_open_local (cmdline_credentials, ev, cmdline_lp_ctx);
}
if (h == NULL)

View File

@ -498,6 +498,7 @@ int main(int argc, char **argv)
poptContext pc;
const char *remote = NULL;
struct regshell_context *ctx;
struct event_context *ev_ctx;
bool ret = true;
struct poptOption long_options[] = {
POPT_AUTOHELP
@ -516,17 +517,19 @@ int main(int argc, char **argv)
ctx = talloc_zero(NULL, struct regshell_context);
ev_ctx = event_context_init(ctx);
if (remote != NULL) {
ctx->registry = reg_common_open_remote(remote, cmdline_lp_ctx,
cmdline_credentials);
} else if (file != NULL) {
ctx->current = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials);
ctx->current = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
if (ctx->current == NULL)
return 1;
ctx->registry = ctx->current->context;
ctx->path = talloc_strdup(ctx, "");
} else {
ctx->registry = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx);
ctx->registry = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx);
}
if (ctx->registry == NULL)

View File

@ -109,6 +109,7 @@ int main(int argc, char **argv)
poptContext pc;
struct registry_context *h = NULL;
struct registry_key *start_key = NULL;
struct event_context *ev_ctx;
WERROR error;
bool fullpath = false, no_values = false;
struct poptOption long_options[] = {
@ -128,12 +129,14 @@ int main(int argc, char **argv)
while((opt = poptGetNextOpt(pc)) != -1) {
}
ev_ctx = event_context_init(NULL);
if (remote != NULL) {
h = reg_common_open_remote(remote, cmdline_lp_ctx, cmdline_credentials);
} else if (file != NULL) {
start_key = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials);
start_key = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
} else {
h = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx);
h = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx);
}
if (h == NULL && start_key == NULL)

View File

@ -132,7 +132,8 @@ AC_CHECK_SIZEOF(off_t)
AC_CHECK_SIZEOF(size_t)
AC_CHECK_SIZEOF(ssize_t)
AC_CHECK_TYPE(intptr_t, unsigned long long)
AC_CHECK_TYPE(intptr_t, long long)
AC_CHECK_TYPE(uintptr_t, unsigned long long)
AC_CHECK_TYPE(ptrdiff_t, unsigned long long)
if test x"$ac_cv_type_long_long" != x"yes";then

View File

@ -458,7 +458,7 @@ char *rep_strcasestr(const char *haystack, const char *needle)
for (s=haystack;*s;s++) {
if (toupper(*needle) == toupper(*s) &&
strncasecmp(s, needle, nlen) == 0) {
return (char *)((intptr_t)s);
return (char *)((uintptr_t)s);
}
}
return NULL;

View File

@ -499,7 +499,7 @@ typedef int bool;
Also, please call this via the discard_const_p() macro interface, as that
makes the return type safe.
*/
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
/** Type-safe version of discard_const */
#define discard_const_p(type, ptr) ((type *)discard_const(ptr))

View File

@ -86,7 +86,7 @@ static bool test_udp(struct torture_context *tctx)
torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size");
torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
torture_assert_mem_equal(tctx, blob2.data, blob.data, size,
"Bad data in recvfrom");
generate_random_buffer(blob.data, blob.length);
@ -104,7 +104,7 @@ static bool test_udp(struct torture_context *tctx)
torture_assert_int_equal(tctx, from_addr->port, srv_addr->port,
"Unexpected recvfrom port");
torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
torture_assert_mem_equal(tctx, blob2.data, blob.data, size,
"Bad data in recvfrom");
talloc_free(sock1);
@ -124,7 +124,7 @@ static bool test_tcp(struct torture_context *tctx)
DATA_BLOB blob, blob2;
size_t sent, nread;
TALLOC_CTX *mem_ctx = tctx;
struct event_context *ev = event_context_init(mem_ctx);
struct event_context *ev = tctx->ev;
struct interface *ifaces;
status = socket_create("ip", SOCKET_TYPE_STREAM, &sock1, 0);
@ -181,7 +181,7 @@ static bool test_tcp(struct torture_context *tctx)
torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size");
torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
torture_assert_mem_equal(tctx, blob2.data, blob.data, size,
"Bad data in recv");
return true;
}

View File

@ -48,7 +48,8 @@ static double timeval_elapsed(struct timeval *tv)
}
#define torture_assert_str_equal(test, arg1, arg2, desc) \
if (strcmp(arg1, arg2)) { \
if (arg1 == NULL && arg2 == NULL) { \
} else if (strcmp(arg1, arg2)) { \
printf("failure: %s [\n%s: Expected %s, got %s: %s\n]\n", \
test, __location__, arg1, arg2, desc); \
return false; \

View File

@ -23,7 +23,7 @@ LIBSAMBA-UTIL_OBJ_FILES = $(addprefix lib/util/, \
mutex.o \
idtree.o \
become_daemon.o \
params.o
params.o)
PUBLIC_HEADERS += $(addprefix lib/util/, util.h \
attr.h \

View File

@ -45,9 +45,9 @@ static bool test_file_load_save(struct torture_context *tctx)
data = file_load(TEST_FILENAME, &len, mem_ctx);
torture_assert(tctx, data, "loading file");
torture_assert(tctx, len == strlen(TEST_DATA), "Length");
torture_assert_int_equal(tctx, len, strlen(TEST_DATA), "Length");
torture_assert(tctx, memcmp(data, TEST_DATA, len) == 0, "Contents");
torture_assert_mem_equal(tctx, data, TEST_DATA, len, "Contents");
unlink(TEST_FILENAME);
return true;

View File

@ -64,7 +64,7 @@ extern const char *panic_action;
makes the return type safe.
*/
#ifndef discard_const
#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
#endif
/** Type-safe version of discard_const */

View File

@ -250,11 +250,7 @@ struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
cldap = talloc(mem_ctx, struct cldap_socket);
if (cldap == NULL) goto failed;
if (event_ctx == NULL) {
cldap->event_ctx = event_context_init(cldap);
} else {
cldap->event_ctx = talloc_reference(cldap, event_ctx);
}
cldap->event_ctx = talloc_reference(cldap, event_ctx);
if (cldap->event_ctx == NULL) goto failed;
cldap->idr = idr_init(cldap);
@ -601,8 +597,11 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
NTSTATUS status;
enum ndr_err_code ndr_err;
struct cldap_search search;
struct cldap_socket *cldap;
DATA_BLOB *data;
cldap = req->cldap;
status = cldap_search_recv(req, mem_ctx, &search);
if (!NT_STATUS_IS_OK(status)) {
return status;
@ -620,7 +619,7 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
data = search.out.response->attributes[0].values;
ndr_err = ndr_pull_union_blob_all(data, mem_ctx,
req->cldap->iconv_convenience,
cldap->iconv_convenience,
&io->out.netlogon,
io->in.version & 0xF,
(ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);

View File

@ -33,13 +33,14 @@
*/
bool smbcli_socket_connect(struct smbcli_state *cli, const char *server,
const char **ports,
struct event_context *ev_ctx,
struct resolve_context *resolve_ctx,
struct smbcli_options *options)
{
struct smbcli_socket *sock;
sock = smbcli_sock_connect_byname(server, ports, NULL, resolve_ctx,
NULL);
sock = smbcli_sock_connect_byname(server, ports, NULL,
resolve_ctx, ev_ctx);
if (sock == NULL) return false;

View File

@ -42,7 +42,11 @@ _PUBLIC_ struct composite_context *composite_create(TALLOC_CTX *mem_ctx,
c = talloc_zero(mem_ctx, struct composite_context);
if (!c) return NULL;
c->state = COMPOSITE_STATE_IN_PROGRESS;
c->event_ctx = ev;
c->event_ctx = talloc_reference(c, ev);
if (!c->event_ctx) {
talloc_free(c);
return NULL;
}
return c;
}

View File

@ -167,11 +167,7 @@ struct nbt_dgram_socket *nbt_dgram_socket_init(TALLOC_CTX *mem_ctx,
dgmsock = talloc(mem_ctx, struct nbt_dgram_socket);
if (dgmsock == NULL) goto failed;
if (event_ctx == NULL) {
dgmsock->event_ctx = event_context_init(dgmsock);
} else {
dgmsock->event_ctx = talloc_reference(dgmsock, event_ctx);
}
dgmsock->event_ctx = talloc_reference(dgmsock, event_ctx);
if (dgmsock->event_ctx == NULL) goto failed;
status = socket_create("ip", SOCKET_TYPE_DGRAM, &dgmsock->sock, 0);

View File

@ -200,7 +200,7 @@ static struct ldap_message *new_ldap_sasl_bind_msg(struct ldap_connection *conn,
/*
perform a sasl bind using the given credentials
*/
_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
struct cli_credentials *creds,
struct loadparm_context *lp_ctx)
{
@ -223,7 +223,8 @@ _PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
gensec_init(lp_ctx);
status = gensec_client_start(conn, &conn->gensec, NULL, lp_ctx);
status = gensec_client_start(conn, &conn->gensec,
conn->event.event_ctx, lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to start GENSEC engine (%s)\n", nt_errstr(status)));
goto failed;

Some files were not shown because too many files have changed in this diff Show More