mirror of
https://github.com/samba-team/samba.git
synced 2025-09-18 09:44:19 +03:00
Move the claim_connection stuff till a little later in the process.
(You don't have to clean up somthing you haven't done yet...)
This commit is contained in:
@@ -527,17 +527,6 @@ connection_struct *make_connection(char *service,char *user,char *password, int
|
|||||||
initialise_groups(conn->user, conn->uid, conn->gid);
|
initialise_groups(conn->user, conn->uid, conn->gid);
|
||||||
get_current_groups(&conn->ngroups,&conn->groups);
|
get_current_groups(&conn->ngroups,&conn->groups);
|
||||||
|
|
||||||
/* check number of connections */
|
|
||||||
if (!claim_connection(conn,
|
|
||||||
lp_servicename(SNUM(conn)),
|
|
||||||
lp_max_connections(SNUM(conn)),
|
|
||||||
False)) {
|
|
||||||
DEBUG(1,("too many connections - rejected\n"));
|
|
||||||
*ecode = ERRnoresource;
|
|
||||||
conn_free(conn);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
conn->nt_user_token = create_nt_token(conn->uid, conn->gid,
|
conn->nt_user_token = create_nt_token(conn->uid, conn->gid,
|
||||||
conn->ngroups, conn->groups,
|
conn->ngroups, conn->groups,
|
||||||
guest);
|
guest);
|
||||||
@@ -557,8 +546,6 @@ connection_struct *make_connection(char *service,char *user,char *password, int
|
|||||||
*ecode = ERRaccess;
|
*ecode = ERRaccess;
|
||||||
DEBUG(0,( "make_connection: connection to %s denied due to security descriptor.\n",
|
DEBUG(0,( "make_connection: connection to %s denied due to security descriptor.\n",
|
||||||
service ));
|
service ));
|
||||||
yield_connection(conn, lp_servicename(SNUM(conn)), lp_max_connections(SNUM(conn)));
|
|
||||||
conn_free(conn);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
conn->read_only = True;
|
conn->read_only = True;
|
||||||
@@ -569,11 +556,20 @@ connection_struct *make_connection(char *service,char *user,char *password, int
|
|||||||
|
|
||||||
if (!vfs_init(conn)) {
|
if (!vfs_init(conn)) {
|
||||||
DEBUG(0, ("vfs_init failed for service %s\n", lp_servicename(SNUM(conn))));
|
DEBUG(0, ("vfs_init failed for service %s\n", lp_servicename(SNUM(conn))));
|
||||||
yield_connection(conn, lp_servicename(SNUM(conn)), lp_max_connections(SNUM(conn)));
|
|
||||||
conn_free(conn);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* check number of connections */
|
||||||
|
if (!claim_connection(conn,
|
||||||
|
lp_servicename(SNUM(conn)),
|
||||||
|
lp_max_connections(SNUM(conn)),
|
||||||
|
False)) {
|
||||||
|
DEBUG(1,("too many connections - rejected\n"));
|
||||||
|
*ecode = ERRnoresource;
|
||||||
|
conn_free(conn);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* execute any "root preexec = " line */
|
/* execute any "root preexec = " line */
|
||||||
if (*lp_rootpreexec(SNUM(conn))) {
|
if (*lp_rootpreexec(SNUM(conn))) {
|
||||||
pstring cmd;
|
pstring cmd;
|
||||||
@@ -583,7 +579,9 @@ connection_struct *make_connection(char *service,char *user,char *password, int
|
|||||||
ret = smbrun(cmd,NULL);
|
ret = smbrun(cmd,NULL);
|
||||||
if (ret != 0 && lp_rootpreexec_close(SNUM(conn))) {
|
if (ret != 0 && lp_rootpreexec_close(SNUM(conn))) {
|
||||||
DEBUG(1,("preexec gave %d - failing connection\n", ret));
|
DEBUG(1,("preexec gave %d - failing connection\n", ret));
|
||||||
yield_connection(conn, lp_servicename(SNUM(conn)), lp_max_connections(SNUM(conn)));
|
yield_connection(conn,
|
||||||
|
lp_servicename(SNUM(conn)),
|
||||||
|
lp_max_connections(SNUM(conn)));
|
||||||
conn_free(conn);
|
conn_free(conn);
|
||||||
*ecode = ERRsrverror;
|
*ecode = ERRsrverror;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user