[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-741-gd9ada60

Jelmer Vernooij jelmer at samba.org
Sun Sep 27 10:42:43 MDT 2009


The branch, master has been updated
       via  d9ada600cc81603300a0cfce75179c6aa1ac94cc (commit)
       via  43267812e17cc7749bb9275574af5eccc74129e5 (commit)
       via  c526a7789694b30b4266c61941686adbf37434a4 (commit)
       via  95fafa9d8398e86391cbd9ced9ea24a28b069f5f (commit)
       via  db55ea08bca48a3b8d6332f08a9db44f91b6d8db (commit)
       via  c145888cece8e34af7ba11c786f1693f5ffc3791 (commit)
       via  2dd7c9bc3441c00ba26329d4d1f4f32775a06a75 (commit)
       via  6a79ad7664ec3cbfa98638e15de6ba24983a84b1 (commit)
       via  52a17e5c32fdeb585e6217da705b254b5cf13986 (commit)
       via  9af1c6db0f56854348ef0d3d11f36da16d41f5d0 (commit)
      from  169ff6efea9b0ea9795effc428de0bd578644a2e (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d9ada600cc81603300a0cfce75179c6aa1ac94cc
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Sep 27 17:37:53 2009 +0200

    parmlist: Add more tests.

commit 43267812e17cc7749bb9275574af5eccc74129e5
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Sep 27 16:49:26 2009 +0200

    rpc_server: Fix warnings.

commit c526a7789694b30b4266c61941686adbf37434a4
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Sep 27 16:43:01 2009 +0200

    librpc: Fix path to ndr_standard pc file.

commit 95fafa9d8398e86391cbd9ced9ea24a28b069f5f
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Sep 27 16:34:59 2009 +0200

    selftest: Prefer system tap2subunit if available.

commit db55ea08bca48a3b8d6332f08a9db44f91b6d8db
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Sep 27 14:39:58 2009 +0200

    parmlist: Add basic tests for test_get_int().

commit c145888cece8e34af7ba11c786f1693f5ffc3791
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Sep 27 14:13:38 2009 +0200

    util/parmlist: Add some more comments.

commit 2dd7c9bc3441c00ba26329d4d1f4f32775a06a75
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Sep 26 23:59:35 2009 +0200

    libutil: Add separate utility code for dealing with settings as a
    collection of key/value pairs.

commit 6a79ad7664ec3cbfa98638e15de6ba24983a84b1
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Sep 26 20:55:18 2009 +0200

    gensec: Avoid exposing lp_ctx on the API level.

commit 52a17e5c32fdeb585e6217da705b254b5cf13986
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Sep 26 19:41:59 2009 +0200

    pygensec: Add initial work on a gensec Python module.

commit 9af1c6db0f56854348ef0d3d11f36da16d41f5d0
Author: Wilco Baan Hofman <wilco at baanhofman.nl>
Date:   Sat Sep 26 17:05:34 2009 +0200

    regshell: Add support for 'cd ..' and cd relative to the root.
    
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/util/config.mk                    |    1 +
 lib/util/parmlist.c                   |  106 ++++++++++++++++++++++++
 lib/util/parmlist.h                   |   56 +++++++++++++
 lib/util/tests/parmlist.c             |  106 ++++++++++++++++++++++++
 source4/auth/gensec/config.mk         |    5 +
 source4/auth/gensec/gensec.c          |   22 +++---
 source4/auth/gensec/gensec.h          |    2 +-
 source4/auth/gensec/pygensec.c        |  144 +++++++++++++++++++++++++++++++++
 source4/auth/gensec/spnego.c          |    2 +-
 source4/auth/gensec/tests/bindings.py |   35 ++++++++
 source4/ldap_server/ldap_backend.c    |    2 +-
 source4/lib/registry/tools/regshell.c |   81 +++++++++++++++++--
 source4/librpc/config.mk              |    2 +-
 source4/param/generic.c               |   89 ++++++++------------
 source4/param/loadparm.c              |   24 +++---
 source4/param/param.h                 |   15 +---
 source4/rpc_server/common/common.h    |    2 +
 source4/selftest/tests.sh             |    7 ++-
 source4/torture/local/config.mk       |    1 +
 source4/torture/local/local.c         |    1 +
 20 files changed, 602 insertions(+), 101 deletions(-)
 create mode 100644 lib/util/parmlist.c
 create mode 100644 lib/util/parmlist.h
 create mode 100644 lib/util/tests/parmlist.c
 create mode 100644 source4/auth/gensec/pygensec.c
 create mode 100644 source4/auth/gensec/tests/bindings.py


Changeset truncated at 500 lines:

diff --git a/lib/util/config.mk b/lib/util/config.mk
index 6dc8354..9f33b0f 100644
--- a/lib/util/config.mk
+++ b/lib/util/config.mk
@@ -33,6 +33,7 @@ LIBSAMBA-UTIL_OBJ_FILES = $(addprefix $(libutilsrcdir)/, \
 		talloc_stack.o \
 		smb_threads.o \
 		params.o \
+		parmlist.o \
 		util_id.o)
 
 PUBLIC_HEADERS += $(addprefix $(libutilsrcdir)/, util.h \
diff --git a/lib/util/parmlist.c b/lib/util/parmlist.c
new file mode 100644
index 0000000..6658fa7
--- /dev/null
+++ b/lib/util/parmlist.c
@@ -0,0 +1,106 @@
+/* 
+ *  Unix SMB/CIFS implementation.
+ *  Copyright (C) Jelmer Vernooij			2009
+ *  
+ *  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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "includes.h"
+#include "../lib/util/dlinklist.h"
+#include "../lib/util/parmlist.h"
+
+struct parmlist_entry *parmlist_get(struct parmlist *ctx, const char *name)
+{
+	struct parmlist_entry *e;
+	for (e = ctx->entries; e; e = e->next) {
+		if (strcasecmp(e->key, name) == 0)
+			return e;
+	}
+
+	return NULL;
+}
+
+int parmlist_get_int(struct parmlist *ctx, const char *name, int default_v)
+{
+	struct parmlist_entry *p = parmlist_get(ctx, name);
+
+	if (p != NULL)
+		return strtol(p->value, NULL, 0); 
+
+	return default_v;
+}
+
+bool parmlist_get_bool(struct parmlist *ctx, const char *name, bool default_v)
+{
+	struct parmlist_entry *p = parmlist_get(ctx, name);
+	bool ret;
+
+	if (p == NULL)
+		return default_v;
+
+	if (!set_boolean(p->value, &ret)) {
+		DEBUG(0,("lp_bool(%s): value is not boolean!\n", p->value));
+		return default_v;
+	}
+
+	return ret;
+}
+
+const char *parmlist_get_string(struct parmlist *ctx, const char *name, 
+								const char *default_v)
+{
+	struct parmlist_entry *p = parmlist_get(ctx, name);
+
+	if (p == NULL)
+		return default_v;
+
+	return p->value;
+}
+
+const char **parmlist_get_string_list(struct parmlist *ctx, const char *name, 
+									  const char *separator)
+{
+	struct parmlist_entry *p = parmlist_get(ctx, name);
+
+	if (p == NULL)
+		return NULL;
+
+	return (const char **)str_list_make(ctx, p->value, separator);
+}
+
+static struct parmlist_entry *parmlist_get_add(struct parmlist *ctx, const char *name)
+{
+	struct parmlist_entry *e = parmlist_get(ctx, name);
+
+	if (e != NULL)
+		return e;
+
+	e = talloc(ctx, struct parmlist_entry);
+	if (e == NULL)
+		return NULL;
+	e->key = talloc_strdup(e, name);
+	DLIST_ADD(ctx->entries, e);
+	return e;
+}
+
+int parmlist_set_string(struct parmlist *ctx, const char *name, 
+						const char *value)
+{
+	struct parmlist_entry *e = parmlist_get_add(ctx, name);
+	if (e == NULL)
+		return -1;
+
+	e->value = talloc_strdup(e, value);
+	return 0;
+}
diff --git a/lib/util/parmlist.h b/lib/util/parmlist.h
new file mode 100644
index 0000000..b320afe
--- /dev/null
+++ b/lib/util/parmlist.h
@@ -0,0 +1,56 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Generic parameter parsing interface
+   Copyright (C) Jelmer Vernooij					  2009
+   
+   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, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _PARMLIST_H /* _PARMLIST_H */
+#define _PARMLIST_H 
+
+struct parmlist_entry {
+	struct parmlist_entry *prev, *next;
+	char *key;
+	char *value;
+	int priority;
+};
+
+struct parmlist {
+	struct parmlist_entry *entries;
+};
+
+/** Retrieve an integer from a parameter list. If not found, return default_v. */
+int parmlist_get_int(struct parmlist *ctx, const char *name, int default_v);
+
+/** Retrieve a string from a parameter list. If not found, return default_v. */
+const char *parmlist_get_string(struct parmlist *ctx, const char *name, 
+								const char *default_v);
+
+/** Retrieve the struct for an entry in a parmlist. */
+struct parmlist_entry *parmlist_get(struct parmlist *ctx, const char *name);
+
+/** Retrieve a string list from a parameter list. 
+ * separator can contain characters to consider separators or can be 
+ * NULL for the default set. */
+const char **parmlist_get_string_list(struct parmlist *ctx, const char *name, 
+									  const char *separator);
+
+/** Retrieve boolean from a parameter list. If not set, return default_v. */
+bool parmlist_get_bool(struct parmlist *ctx, const char *name, bool default_v);
+
+/** Set a parameter. */
+int parmlist_set_string(struct parmlist *ctx, const char *name, const char *value);
+
+#endif /* _PARMLIST_H */
diff --git a/lib/util/tests/parmlist.c b/lib/util/tests/parmlist.c
new file mode 100644
index 0000000..4b1d875
--- /dev/null
+++ b/lib/util/tests/parmlist.c
@@ -0,0 +1,106 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   parmlist testing
+
+   Copyright (C) Jelmer Vernooij 2009
+   
+   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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "torture/torture.h"
+#include "../lib/util/parmlist.h"
+
+static bool test_get_int(struct torture_context *tctx)
+{
+	struct parmlist *pctx = talloc_zero(tctx, struct parmlist);
+	parmlist_set_string(pctx, "bar", "3");
+	parmlist_set_string(pctx, "notint", "bla");
+	torture_assert_int_equal(tctx, 3, parmlist_get_int(pctx, "bar", 42), 
+							 "existing");
+	torture_assert_int_equal(tctx, 42, parmlist_get_int(pctx, "foo", 42),
+							 "default");
+	torture_assert_int_equal(tctx, 0, parmlist_get_int(pctx, "notint", 42),
+							 "Not an integer");
+	return true;
+}
+
+static bool test_get_string(struct torture_context *tctx)
+{
+	struct parmlist *pctx = talloc_zero(tctx, struct parmlist);
+	parmlist_set_string(pctx, "bar", "mystring");
+	torture_assert_str_equal(tctx, "mystring", 
+		parmlist_get_string(pctx, "bar", "bla"), "existing");
+	torture_assert_str_equal(tctx, "bla", 
+		parmlist_get_string(pctx, "foo", "bla"), "default");
+	return true;
+}
+
+static bool test_get(struct torture_context *tctx)
+{
+	struct parmlist *pctx = talloc_zero(tctx, struct parmlist);
+	struct parmlist_entry *e;
+	parmlist_set_string(pctx, "bar", "mystring");
+
+	e = parmlist_get(pctx, "bar");
+	torture_assert(tctx, e != NULL, "entry");
+	torture_assert_str_equal(tctx, e->key, "bar", "key");
+	torture_assert_str_equal(tctx, e->value, "mystring", "value");
+
+	e = parmlist_get(pctx, "nonexistant");
+	torture_assert(tctx, e == NULL, "nonexistant");
+	return true;
+}
+
+static bool test_get_bool(struct torture_context *tctx)
+{
+	struct parmlist *pctx = talloc_zero(tctx, struct parmlist);
+	parmlist_set_string(pctx, "bar", "true");
+	parmlist_set_string(pctx, "gasoline", "invalid");
+
+	torture_assert(tctx, parmlist_get_bool(pctx, "bar", false), "set");
+	torture_assert(tctx, !parmlist_get_bool(pctx, "foo", false), "default");
+	torture_assert(tctx, !parmlist_get_bool(pctx, "gasoline", false), 
+				   "invalid");
+	return true;
+}
+
+static bool test_get_string_list(struct torture_context *tctx)
+{
+	struct parmlist *pctx = talloc_zero(tctx, struct parmlist);
+	const char **ret;
+	parmlist_set_string(pctx, "bar", "true, false");
+
+	ret = parmlist_get_string_list(pctx, "bar", NULL);
+	torture_assert_int_equal(tctx, str_list_length(ret), 2, "length");
+	torture_assert_str_equal(tctx, "true", ret[0], "ret[0]");
+	torture_assert_str_equal(tctx, "false", ret[1], "ret[1]");
+	torture_assert(tctx, NULL == parmlist_get_string_list(pctx, "nonexistant", NULL), "nonexistant");
+
+	return true;
+}
+
+struct torture_suite *torture_local_util_parmlist(TALLOC_CTX *mem_ctx)
+{
+	struct torture_suite *suite = torture_suite_create(mem_ctx, "PARMLIST");
+
+	torture_suite_add_simple_test(suite, "get_int", test_get_int);
+	torture_suite_add_simple_test(suite, "get_string", test_get_string);
+	torture_suite_add_simple_test(suite, "get", test_get);
+	torture_suite_add_simple_test(suite, "get_bool", test_get_bool);
+	torture_suite_add_simple_test(suite, "get_string_list", test_get_string_list);
+
+	return suite;
+}
diff --git a/source4/auth/gensec/config.mk b/source4/auth/gensec/config.mk
index 105a58b..65f5208 100644
--- a/source4/auth/gensec/config.mk
+++ b/source4/auth/gensec/config.mk
@@ -85,3 +85,8 @@ PRIVATE_DEPENDENCIES = LDB_WRAP COMMON_SCHANNELDB
 SCHANNELDB_OBJ_FILES = $(addprefix $(gensecsrcdir)/, schannel_state.o)
 $(eval $(call proto_header_template,$(gensecsrcdir)/schannel_state.h,$(SCHANNELDB_OBJ_FILES:.o=.c)))
 
+[PYTHON::pygensec]
+PRIVATE_DEPENDENCIES = gensec PYTALLOC
+LIBRARY_REALNAME = samba/gensec.$(SHLIBEXT)
+
+pygensec_OBJ_FILES = $(gensecsrcdir)/pygensec.o
diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c
index 1addf93..5df9128 100644
--- a/source4/auth/gensec/gensec.c
+++ b/source4/auth/gensec/gensec.c
@@ -40,10 +40,9 @@ _PUBLIC_ struct gensec_security_ops **gensec_security_all(void)
 	return generic_security_ops;
 }
 
-bool gensec_security_ops_enabled(struct gensec_security_ops *ops, 
-				 struct loadparm_context *lp_ctx)
+bool gensec_security_ops_enabled(struct gensec_security_ops *ops, struct gensec_security *security)
 {
-	return lp_parm_bool(lp_ctx, NULL, "gensec", ops->name, ops->enabled);
+	return lp_parm_bool(security->settings->lp_ctx, NULL, "gensec", ops->name, ops->enabled);
 }
 
 /* Sometimes we want to force only kerberos, sometimes we want to
@@ -147,9 +146,8 @@ static const struct gensec_security_ops *gensec_security_by_authtype(struct gens
 	}
 	backends = gensec_security_mechs(gensec_security, mem_ctx);
 	for (i=0; backends && backends[i]; i++) {
-	    	if (!gensec_security_ops_enabled(backends[i], 
-											 gensec_security->settings->lp_ctx))
-		    continue;
+	    	if (!gensec_security_ops_enabled(backends[i], gensec_security))
+				continue;
 		if (backends[i]->auth_type == auth_type) {
 			backend = backends[i];
 			talloc_free(mem_ctx);
@@ -175,7 +173,7 @@ const struct gensec_security_ops *gensec_security_by_oid(struct gensec_security
 	for (i=0; backends && backends[i]; i++) {
 	    	if (gensec_security != NULL && 
 				!gensec_security_ops_enabled(backends[i], 
-											 gensec_security->settings->lp_ctx))
+											 gensec_security))
 		    continue;
 		if (backends[i]->oid) {
 			for (j=0; backends[i]->oid[j]; j++) { 
@@ -205,7 +203,7 @@ const struct gensec_security_ops *gensec_security_by_sasl_name(struct gensec_sec
 	}
 	backends = gensec_security_mechs(gensec_security, mem_ctx);
 	for (i=0; backends && backends[i]; i++) {
-	    	if (!gensec_security_ops_enabled(backends[i], gensec_security->settings->lp_ctx))
+	    	if (!gensec_security_ops_enabled(backends[i], gensec_security))
 		    continue;
 		if (backends[i]->sasl_name 
 		    && (strcmp(backends[i]->sasl_name, sasl_name) == 0)) {
@@ -232,7 +230,7 @@ static const struct gensec_security_ops *gensec_security_by_name(struct gensec_s
 	backends = gensec_security_mechs(gensec_security, mem_ctx);
 	for (i=0; backends && backends[i]; i++) {
 	    	if (gensec_security != NULL && 
-				!gensec_security_ops_enabled(backends[i], gensec_security->settings->lp_ctx))
+				!gensec_security_ops_enabled(backends[i], gensec_security))
 		    continue;
 		if (backends[i]->name 
 		    && (strcmp(backends[i]->name, name) == 0)) {
@@ -278,7 +276,7 @@ const struct gensec_security_ops **gensec_security_by_sasl_list(struct gensec_se
 	 * then looking in the supplied list */
 	for (i=0; backends && backends[i]; i++) {
 	    	if (gensec_security != NULL &&
-				!gensec_security_ops_enabled(backends[i], gensec_security->settings->lp_ctx))
+				!gensec_security_ops_enabled(backends[i], gensec_security))
 		    continue;
 		for (sasl_idx = 0; sasl_names[sasl_idx]; sasl_idx++) {
 			if (!backends[i]->sasl_name ||
@@ -349,7 +347,7 @@ const struct gensec_security_ops_wrapper *gensec_security_by_oid_list(struct gen
 	 * then looking in the supplied list */
 	for (i=0; backends && backends[i]; i++) {
 	    	if (gensec_security != NULL && 
-				!gensec_security_ops_enabled(backends[i], gensec_security->settings->lp_ctx))
+				!gensec_security_ops_enabled(backends[i], gensec_security))
 		    continue;
 		if (!backends[i]->oid) {
 			continue;
@@ -418,7 +416,7 @@ const char **gensec_security_oids_from_ops(struct gensec_security *gensec_securi
 	
 	for (i=0; ops && ops[i]; i++) {
 		if (gensec_security != NULL && 
-			!gensec_security_ops_enabled(ops[i], gensec_security->settings->lp_ctx)) {
+			!gensec_security_ops_enabled(ops[i], gensec_security)) {
 			continue;
 		}
 		if (!ops[i]->oid) {
diff --git a/source4/auth/gensec/gensec.h b/source4/auth/gensec/gensec.h
index 3b27e0f..8c1716e 100644
--- a/source4/auth/gensec/gensec.h
+++ b/source4/auth/gensec/gensec.h
@@ -304,7 +304,7 @@ NTSTATUS gensec_wrap(struct gensec_security *gensec_security,
 		     DATA_BLOB *out);
 
 struct gensec_security_ops **gensec_security_all(void);
-bool gensec_security_ops_enabled(struct gensec_security_ops *ops, struct loadparm_context *lp_ctx);
+bool gensec_security_ops_enabled(struct gensec_security_ops *ops, struct gensec_security *security);
 struct gensec_security_ops **gensec_use_kerberos_mechs(TALLOC_CTX *mem_ctx, 
 						       struct gensec_security_ops **old_gensec_list, 
 						       struct cli_credentials *creds);
diff --git a/source4/auth/gensec/pygensec.c b/source4/auth/gensec/pygensec.c
new file mode 100644
index 0000000..efa97e0
--- /dev/null
+++ b/source4/auth/gensec/pygensec.c
@@ -0,0 +1,144 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2009
+   
+   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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include <Python.h>
+#include "param/param.h"
+#include "auth/gensec/gensec.h"
+#include "libcli/util/pyerrors.h"
+#include "pytalloc.h"
+#include <tevent.h>
+
+#ifndef Py_RETURN_NONE
+#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
+#endif
+
+static PyObject *py_get_name_by_authtype(PyObject *self, PyObject *args)
+{
+	int type;
+	const char *name;
+	struct gensec_security *security;
+
+	if (!PyArg_ParseTuple(args, "i", &type))
+		return NULL;
+
+	security = (struct gensec_security *)py_talloc_get_ptr(self);
+
+	name = gensec_get_name_by_authtype(security, type);
+	if (name == NULL)
+		Py_RETURN_NONE;
+
+	return PyString_FromString(name);
+}
+
+static struct gensec_settings *settings_from_object(PyObject *object)
+{
+	return NULL; /* FIXME */
+}
+
+static PyObject *py_gensec_start_client(PyTypeObject *type, PyObject *args, PyObject *kwargs)
+{
+	NTSTATUS status;
+	py_talloc_Object *self;
+	struct gensec_settings *settings;
+	const char *kwnames[] = { "settings", NULL };
+	PyObject *py_settings;
+	struct tevent_context *ev;
+
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwnames, &py_settings))
+		return NULL;
+
+	settings = settings_from_object(py_settings);
+	if (settings == NULL)
+		return NULL;
+	
+	self = (py_talloc_Object*)type->tp_alloc(type, 0);
+	if (self == NULL) {
+		PyErr_NoMemory();
+		return NULL;
+	}
+	self->talloc_ctx = talloc_new(NULL);
+	if (self->talloc_ctx == NULL) {
+		PyErr_NoMemory();
+		return NULL;
+	}
+	ev = tevent_context_init(self->talloc_ctx);
+	if (ev == NULL) {
+		PyErr_NoMemory();
+		PyObject_Del(self);
+		return NULL;
+	}
+	status = gensec_client_start(self->talloc_ctx, 
+		(struct gensec_security **)&self->ptr, ev, settings);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list