From a1aafce4dc69b4bc4967ce9b70550ee3ecfab43b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 4 Sep 2002 19:13:06 +0000 Subject: Add bcast_msg_flags to connection struct. Allows sender to filter when sending broadcast messages. Also initial cut-down of printing notify messages (not yet finished). Jeremy. (This used to be commit aca333719695b278843c59e1c6eb07d6655fd59c) --- source3/smbd/connection.c | 13 +++++++------ source3/smbd/reply.c | 2 +- source3/smbd/server.c | 2 +- source3/smbd/service.c | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 5609c2963d..bc897a95cb 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -28,10 +28,9 @@ static TDB_CONTEXT *tdb; TDB_CONTEXT *conn_tdb_ctx(void) { - if (!tdb) { + if (!tdb) tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDWR | O_CREAT, 0644); - } return tdb; } @@ -45,7 +44,8 @@ BOOL yield_connection(connection_struct *conn,char *name) struct connections_key key; TDB_DATA kbuf; - if (!tdb) return False; + if (!tdb) + return False; DEBUG(3,("Yielding connection to %s\n",name)); @@ -111,16 +111,16 @@ static int count_fn( TDB_CONTEXT *the_tdb, TDB_DATA kbuf, TDB_DATA dbuf, void *u Claim an entry in the connections database. ****************************************************************************/ -BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOOL Clear) +BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOOL Clear, uint32 msg_flags) { struct connections_key key; struct connections_data crec; TDB_DATA kbuf, dbuf; - if (!tdb) { + if (!tdb) tdb = tdb_open_log(lock_path("connections.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDWR | O_CREAT, 0644); - } + if (!tdb) return False; @@ -176,6 +176,7 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO lp_servicename(SNUM(conn)),sizeof(crec.name)-1); } crec.start = time(NULL); + crec.bcast_msg_flags = msg_flags; StrnCpy(crec.machine,get_remote_machine_name(),sizeof(crec.machine)-1); StrnCpy(crec.addr,conn?conn->client_address:client_addr(),sizeof(crec.addr)-1); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 010f0e47d3..263626dcc1 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -113,7 +113,7 @@ int reply_special(char *inbuf,char *outbuf) reload_services(True); reopen_logs(); - claim_connection(NULL,"",MAXSTATUS,True); + claim_connection(NULL,"",0,True,FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINTING); already_got_session = True; break; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index c748a87da2..8082c22cff 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -858,7 +858,7 @@ static void usage(char *pname) register_dmalloc_msgs(); /* Setup the main smbd so that we can get messages. */ - claim_connection(NULL,"",0,True); + claim_connection(NULL,"",0,True,FLAG_MSG_GENERAL|FLAG_MSG_SMBD); /* DO NOT ENABLE THIS TILL YOU COPE WITH KILLING THESE TASKS AND INETD diff --git a/source3/smbd/service.c b/source3/smbd/service.c index d475451e6b..a8a590da80 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -578,7 +578,7 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, if (!claim_connection(conn, lp_servicename(SNUM(conn)), lp_max_connections(SNUM(conn)), - False)) { + False,0)) { DEBUG(1,("too many connections - rejected\n")); conn_free(conn); *status = NT_STATUS_INSUFFICIENT_RESOURCES; -- cgit