diff options
author | Volker Lendecke <vlendec@samba.org> | 2007-05-27 16:34:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:22:51 -0500 |
commit | 14e25f10d6a3da34fb8b29c4331571efa11ee3b8 (patch) | |
tree | 7369abad85080ebb67627e264bfe00a7b3777f0c /source3/smbd/service.c | |
parent | f3c477c631e7318ccaa6f277731b721a462112b8 (diff) | |
download | samba-14e25f10d6a3da34fb8b29c4331571efa11ee3b8.tar.gz samba-14e25f10d6a3da34fb8b29c4331571efa11ee3b8.tar.bz2 samba-14e25f10d6a3da34fb8b29c4331571efa11ee3b8.zip |
r23168: Move the lp_max_connections() into service.c.
(This used to be commit 4afe37d431b6eb475769a2057025da9aa8d1bb14)
Diffstat (limited to 'source3/smbd/service.c')
-rw-r--r-- | source3/smbd/service.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 5b087fd583..2b84223695 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -989,17 +989,31 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, } /* ROOT Activities: */ - /* check number of connections */ - if (!claim_connection(conn, - lp_servicename(snum), - lp_max_connections(snum), - 0)) { - DEBUG(1,("too many connections - rejected\n")); + /* + * Enforce the max connections parameter. + */ + + if ((lp_max_connections(snum) > 0) + && (count_current_connections(lp_servicename(SNUM(conn)), True) >= + lp_max_connections(snum))) { + + DEBUG(1, ("Max connections (%d) exceeded for %s\n", + lp_max_connections(snum), lp_servicename(snum))); conn_free(conn); *status = NT_STATUS_INSUFFICIENT_RESOURCES; return NULL; } + /* + * Get us an entry in the connections db + */ + if (!claim_connection(conn, lp_servicename(snum), 0)) { + DEBUG(1, ("Could not store connections entry\n")); + conn_free(conn); + *status = NT_STATUS_INTERNAL_DB_ERROR; + return NULL; + } + /* Preexecs are done here as they might make the dir we are to ChDir * to below */ /* execute any "root preexec = " line */ |