diff options
author | Jeremy Allison <jra@samba.org> | 2013-01-08 14:18:27 -0800 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-01-09 14:54:29 +1100 |
commit | 7ba685090487410270415d3e4d69f62947ce34c3 (patch) | |
tree | 7cf05a0585356b394c093a8a6fae5f3113a39873 | |
parent | a9730cb3909d8c8aea64b35342ac763b135e0b1f (diff) | |
download | samba-7ba685090487410270415d3e4d69f62947ce34c3.tar.gz samba-7ba685090487410270415d3e4d69f62947ce34c3.tar.bz2 samba-7ba685090487410270415d3e4d69f62947ce34c3.zip |
source3/smbd/pysmbd.c: Always use create_conn_struct(). Don't hand create connection structs.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source3/smbd/pysmbd.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index 1bac9c27d3..873feadb79 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -46,6 +46,9 @@ static connection_struct *get_conn(TALLOC_CTX *mem_ctx, const char *service) { connection_struct *conn; TALLOC_CTX *frame = talloc_stackframe(); + int snum = -1; + NTSTATUS status; + if (!posix_locking_init(false)) { PyErr_NoMemory(); TALLOC_FREE(frame); @@ -53,39 +56,22 @@ static connection_struct *get_conn(TALLOC_CTX *mem_ctx, const char *service) } if (service) { - NTSTATUS status; - int snum = lp_servicenumber(service); + snum = lp_servicenumber(service); if (snum == -1) { TALLOC_FREE(frame); PyErr_SetString(PyExc_RuntimeError, "unknown service"); return NULL; } - status = create_conn_struct(mem_ctx, NULL, NULL, &conn, snum, "/", - NULL); - PyErr_NTSTATUS_IS_ERR_RAISE(status); - } else { - conn = talloc_zero(mem_ctx, connection_struct); - if (conn == NULL) { - DEBUG(0, ("talloc failed\n")); - TALLOC_FREE(frame); - PyErr_NoMemory(); - return NULL; - } - - if (!(conn->params = talloc(conn, struct share_params))) { - TALLOC_FREE(frame); - DEBUG(0,("get_conn: talloc() failed!\n")); - PyErr_NoMemory(); - return NULL; - } - conn->params->service = -1; + } - set_conn_connectpath(conn, "/"); + status = create_conn_struct(mem_ctx, NULL, NULL, &conn, snum, "/", + NULL); + PyErr_NTSTATUS_IS_ERR_RAISE(status); - smbd_vfs_init(conn); - } TALLOC_FREE(frame); + /* Ignore read-only and share restrictions */ conn->read_only = false; + conn->share_access = SEC_RIGHTS_FILE_ALL; talloc_set_destructor(conn, conn_free_wrapper); return conn; } |