diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-06-20 03:05:09 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-06-20 03:05:09 +0000 |
commit | fcda2645f099e5d356361ec3de4f45d97285f0b5 (patch) | |
tree | 38c0fe748321786e6c457d62f1426d1dca9d572c /source3/smbd | |
parent | 1c831ce6d868ca5f7de498c8c7f90efe2238d1b4 (diff) | |
download | samba-fcda2645f099e5d356361ec3de4f45d97285f0b5.tar.gz samba-fcda2645f099e5d356361ec3de4f45d97285f0b5.tar.bz2 samba-fcda2645f099e5d356361ec3de4f45d97285f0b5.zip |
added a close-share smbcontrol message that forcibly closes a share in smbd (to allow unmount)
(This used to be commit 15b17a80db605a55f667c95fb7e316877a441887)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/conn.c | 30 | ||||
-rw-r--r-- | source3/smbd/process.c | 9 | ||||
-rw-r--r-- | source3/smbd/service.c | 2 |
3 files changed, 41 insertions, 0 deletions
diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index e9f79fdf32..c2faa4f15a 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -198,3 +198,33 @@ void conn_free(connection_struct *conn) ZERO_STRUCTP(conn); free(conn); } + + +/**************************************************************************** +receive a smbcontrol message to forcibly unmount a share +the message contains just a share name and all instances of that +share are unmounted +the special sharename '*' forces unmount of all shares +****************************************************************************/ +void msg_force_tdis(int msg_type, pid_t pid, void *buf, size_t len) +{ + connection_struct *conn, *next; + fstring sharename; + + fstrcpy(sharename, buf); + + if (strcmp(sharename, "*") == 0) { + DEBUG(1,("Forcing close of all shares\n")); + conn_close_all(); + return; + } + + for (conn=Connections;conn;conn=next) { + next=conn->next; + if (strequal(lp_servicename(conn->service), sharename)) { + DEBUG(1,("Forcing close of share %s cnum=%d\n", + sharename, conn->cnum)); + close_cnum(conn, (uint16)-1); + } + } +} diff --git a/source3/smbd/process.c b/source3/smbd/process.c index f757467680..72e0fc311a 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -693,6 +693,12 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize if (!(flags & AS_USER)) unbecome_user(); + /* does this protocol need a valid tree connection? */ + if ((flags & AS_USER) && !conn) { + return ERROR(ERRSRV, ERRinvnid); + } + + /* does this protocol need to be run as the connected user? */ if ((flags & AS_USER) && !become_user(conn,session_tag)) { if (flags & AS_GUEST) @@ -1195,6 +1201,9 @@ void smbd_process(void) /* re-initialise the timezone */ TimeInit(); + /* register our message handlers */ + message_register(MSG_SMB_FORCE_TDIS, msg_force_tdis); + while (True) { int deadtime = lp_deadtime()*60; int select_timeout = setup_select_timeout(); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index c70ab42a61..61da72b2e9 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -697,3 +697,5 @@ void close_cnum(connection_struct *conn, uint16 vuid) } conn_free(conn); } + + |