[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Fri Feb 26 03:40:16 MST 2010
The branch, master has been updated
via b792e55... s4: Winbind allow to behave more correctly when we have more than a few users
via 2572391... s4:python Add bindings to set GENSEC flags on credentials in python
from ee547e7... s3: remove unused schannel_auth_struct.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b792e5575c8dcd1ec4f5a572561a48ea5744000c
Author: Matthieu Patou <mat at matws.net>
Date: Thu Feb 25 20:41:57 2010 +0300
s4: Winbind allow to behave more correctly when we have more than a few users
commit 25723914c5f5b18a25f758f1098ddded3c5aa074
Author: Andrew Bartlett <abartlet at samba.org>
Date: Thu Feb 25 20:22:52 2010 +1100
s4:python Add bindings to set GENSEC flags on credentials in python
This should allow these to be manipulated by python scripts that need
encrypted connections.
Andrew Bartlett
-----------------------------------------------------------------------
Summary of changes:
source4/auth/credentials/pycredentials.c | 23 ++++++++++++++
source4/auth/gensec/pygensec.c | 9 +++++
source4/winbind/wb_cmd_setpwent.c | 49 +++++++++++++++++++++++++-----
3 files changed, 73 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/auth/credentials/pycredentials.c b/source4/auth/credentials/pycredentials.c
index 8602be8..f5e8029 100644
--- a/source4/auth/credentials/pycredentials.c
+++ b/source4/auth/credentials/pycredentials.c
@@ -278,6 +278,27 @@ static PyObject *py_creds_get_named_ccache(py_talloc_Object *self, PyObject *arg
return NULL;
}
+static PyObject *py_creds_set_gensec_features(py_talloc_Object *self, PyObject *args)
+{
+ unsigned int gensec_features;
+
+ if (!PyArg_ParseTuple(args, "I", &gensec_features))
+ return NULL;
+
+ cli_credentials_set_gensec_features(PyCredentials_AsCliCredentials(self), gensec_features);
+
+ Py_RETURN_NONE;
+}
+
+static PyObject *py_creds_get_gensec_features(py_talloc_Object *self, PyObject *args)
+{
+ unsigned int gensec_features;
+
+ gensec_features = cli_credentials_get_gensec_features(PyCredentials_AsCliCredentials(self));
+ return PyInt_FromLong(gensec_features);
+}
+
+
static PyMethodDef py_creds_methods[] = {
{ "get_username", (PyCFunction)py_creds_get_username, METH_NOARGS,
"S.get_username() -> username\nObtain username." },
@@ -335,6 +356,8 @@ static PyMethodDef py_creds_methods[] = {
{ "guess", (PyCFunction)py_creds_guess, METH_VARARGS, NULL },
{ "set_machine_account", (PyCFunction)py_creds_set_machine_account, METH_VARARGS, NULL },
{ "get_named_ccache", (PyCFunction)py_creds_get_named_ccache, METH_VARARGS, NULL },
+ { "set_gensec_features", (PyCFunction)py_creds_set_gensec_features, METH_VARARGS, NULL },
+ { "get_gensec_features", (PyCFunction)py_creds_get_gensec_features, METH_NOARGS, NULL },
{ NULL }
};
diff --git a/source4/auth/gensec/pygensec.c b/source4/auth/gensec/pygensec.c
index 1c2bd20..21acff8 100644
--- a/source4/auth/gensec/pygensec.c
+++ b/source4/auth/gensec/pygensec.c
@@ -177,6 +177,15 @@ void initgensec(void)
if (m == NULL)
return;
+ PyModule_AddObject(m, "FEATURE_SESSION_KEY", PyInt_FromLong(GENSEC_FEATURE_SESSION_KEY));
+ PyModule_AddObject(m, "FEATURE_SIGN", PyInt_FromLong(GENSEC_FEATURE_SIGN));
+ PyModule_AddObject(m, "FEATURE_SEAL", PyInt_FromLong(GENSEC_FEATURE_SEAL));
+ PyModule_AddObject(m, "FEATURE_DCE_STYLE", PyInt_FromLong(GENSEC_FEATURE_DCE_STYLE));
+ PyModule_AddObject(m, "FEATURE_ASYNC_REPLIES", PyInt_FromLong(GENSEC_FEATURE_ASYNC_REPLIES));
+ PyModule_AddObject(m, "FEATURE_DATAGRAM_MODE", PyInt_FromLong(GENSEC_FEATURE_DATAGRAM_MODE));
+ PyModule_AddObject(m, "FEATURE_SIGN_PKT_HEADER", PyInt_FromLong(GENSEC_FEATURE_SIGN_PKT_HEADER));
+ PyModule_AddObject(m, "FEATURE_NEW_SPNEGO", PyInt_FromLong(GENSEC_FEATURE_NEW_SPNEGO));
+
Py_INCREF(&Py_Security);
PyModule_AddObject(m, "Security", (PyObject *)&Py_Security);
}
diff --git a/source4/winbind/wb_cmd_setpwent.c b/source4/winbind/wb_cmd_setpwent.c
index 7fb1889..9384849 100644
--- a/source4/winbind/wb_cmd_setpwent.c
+++ b/source4/winbind/wb_cmd_setpwent.c
@@ -30,6 +30,7 @@ struct cmd_setpwent_state {
struct libnet_context *libnet_ctx;
struct wbsrv_pwent *result;
+ char *domain_name;
};
static void cmd_setpwent_recv_domain(struct composite_context *ctx);
@@ -80,6 +81,8 @@ static void cmd_setpwent_recv_domain(struct composite_context *ctx)
user_list = talloc(state->result, struct libnet_UserList);
if (composite_nomem(user_list, state->ctx)) return;
+ state->domain_name = talloc_strdup(state,
+ domain->libnet_ctx->samr.name);
user_list->in.domain_name = talloc_strdup(state,
domain->libnet_ctx->samr.name);
if (composite_nomem(user_list->in.domain_name, state->ctx)) return;
@@ -93,6 +96,7 @@ static void cmd_setpwent_recv_domain(struct composite_context *ctx)
ctx = libnet_UserList_send(domain->libnet_ctx, state->result, user_list,
NULL);
+ state->result->page_index = -1;
composite_continue(state->ctx, ctx, cmd_setpwent_recv_user_list, state);
}
@@ -101,7 +105,7 @@ static void cmd_setpwent_recv_user_list(struct composite_context *ctx)
struct cmd_setpwent_state *state = talloc_get_type(
ctx->async.private_data, struct cmd_setpwent_state);
struct libnet_UserList *user_list;
-
+ struct libnet_UserList *user_list_send;
DEBUG(5, ("cmd_setpwent_recv_user_list called\n"));
user_list = talloc(state->result, struct libnet_UserList);
@@ -109,13 +113,42 @@ static void cmd_setpwent_recv_user_list(struct composite_context *ctx)
state->ctx->status = libnet_UserList_recv(ctx, state->result,
user_list);
- if (!composite_is_ok(state->ctx)) return;
-
- state->result->user_list = user_list;
- state->result->page_index = 0;
- state->result->libnet_ctx = state->libnet_ctx;
-
- composite_done(state->ctx);
+ if (NT_STATUS_IS_OK(state->ctx->status) ||
+ NT_STATUS_EQUAL(state->ctx->status, STATUS_MORE_ENTRIES)) {
+ if( state->result->page_index == -1) { /* First run*/
+ state->result->user_list = user_list;
+ state->result->page_index = 0;
+ state->result->libnet_ctx = state->libnet_ctx;
+ } else {
+ int i;
+ struct userlist *tmp;
+ tmp = state->result->user_list->out.users;
+ state->result->user_list->out.users = talloc_realloc(state->result,tmp,struct userlist,
+ state->result->user_list->out.count+user_list->out.count);
+ tmp = state->result->user_list->out.users;
+ for(i=0;i<user_list->out.count;i++ ) {
+ tmp[i+state->result->user_list->out.count].username = talloc_steal(state->result,user_list->out.users[i].username);
+ }
+ state->result->user_list->out.count += user_list->out.count;
+ talloc_free(user_list);
+ }
+
+
+ if (NT_STATUS_IS_OK(state->ctx->status) ) {
+ composite_done(state->ctx);
+ } else {
+ user_list_send = talloc(state->result, struct libnet_UserList);
+ if (composite_nomem(user_list_send, state->ctx)) return;
+ user_list_send->in.domain_name = talloc_strdup(state, state->domain_name);
+ user_list_send->in.resume_index = user_list->out.resume_index;
+ user_list_send->in.page_size = 128;
+ ctx = libnet_UserList_send(state->libnet_ctx, state->result, user_list_send, NULL);
+ composite_continue(state->ctx, ctx, cmd_setpwent_recv_user_list, state);
+ }
+ } else {
+ composite_error(state->ctx, state->ctx->status);
+ }
+ return;
}
NTSTATUS wb_cmd_setpwent_recv(struct composite_context *ctx,
--
Samba Shared Repository
More information about the samba-cvs
mailing list