Fix bug #5900 reported by monyo@samba.gr.jp - vfs_readonly.so does not work.
authorJeremy Allison <jra@samba.org>
Mon, 17 Nov 2008 21:46:35 +0000 (13:46 -0800)
committerJeremy Allison <jra@samba.org>
Mon, 17 Nov 2008 21:46:35 +0000 (13:46 -0800)
Jeremy.

source/modules/vfs_readonly.c
source/smbd/share_access.c
source/smbd/uid.c

index d4ddf32e3ac9f29e6990011ceb86791bfda615f1..ccb95b5d8cf15233c0cdc98242e689fb8f6866d7 100644 (file)
@@ -64,12 +64,20 @@ static int readonly_connect(vfs_handle_struct *handle,
                                             "period", period_def); 
 
   if (period && period[0] && period[1]) {
+    int i;
     time_t current_time = time(NULL);
     time_t begin_period = get_date(period[0], &current_time);
     time_t end_period   = get_date(period[1], &current_time);
 
     if ((current_time >= begin_period) && (current_time <= end_period)) {
+      connection_struct *conn = handle->conn;
+
       handle->conn->read_only = True;
+
+      /* Wipe out the VUID cache. */
+      for (i=0;i<conn->vuid_cache.entries && i< VUID_CACHE_SIZE;i++) {
+        conn->vuid_cache.array[i].vuid = UID_FIELD_INVALID;
+      }
     }
 
     return SMB_VFS_NEXT_CONNECT(handle, service, user);
index 512126254a5d17a663a36b1b099f7a51a56f4d29..e89934c2a4e7ab54c1b6f211e5605ffb8c404ce5 100644 (file)
@@ -248,9 +248,11 @@ bool user_ok_token(const char *username, struct nt_user_token *token, int snum)
  */
 
 bool is_share_read_only_for_token(const char *username,
-                                 struct nt_user_token *token, int snum)
+                               struct nt_user_token *token,
+                               connection_struct *conn)
 {
-       bool result = lp_readonly(snum);
+       int snum = SNUM(conn);
+       bool result = conn->read_only;
 
        if (lp_readlist(snum) != NULL) {
                if (token_contains_name_in_list(username,
index ffa643a8f56b5ebe23c8423b3a053b494e22b8fd..631a37fe2a99ba5efbc56bd3fbcbba00eb095bd6 100644 (file)
@@ -102,7 +102,7 @@ static bool check_user_ok(connection_struct *conn, user_struct *vuser,int snum)
 
        readonly_share = is_share_read_only_for_token(vuser->user.unix_name,
                                                      vuser->nt_user_token,
-                                                     SNUM(conn));
+                                                     conn);
 
        token = conn->nt_user_token ?
                conn->nt_user_token : vuser->nt_user_token;