r971: Auto remove store dos attributes if underlying filesystem
authorJeremy Allison <jra@samba.org>
Tue, 1 Jun 2004 20:43:32 +0000 (20:43 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:51:51 +0000 (10:51 -0500)
doesn't support EA's.
Jeremy.
(This used to be commit 9de6b25c9e9abe982e21b0229df520802cafbfd8)

source3/param/loadparm.c
source3/smbd/dosmode.c
source3/smbd/process.c

index 6376e4aa9172f16721797babaecf1176d3858909..f158a35336e01d09bd56605faf021bc7d13cce27 100644 (file)
@@ -4289,3 +4289,14 @@ BOOL lp_use_sendfile(int snum)
 {
        return (_lp_use_sendfile(snum) && !srv_is_signing_active());
 }
+
+/*******************************************************************
+ Turn off storing DOS attributes if this share doesn't support it.
+********************************************************************/
+
+void set_store_dos_attributes(int snum, BOOL val)
+{
+       if (!LP_SNUM_OK(snum))
+               return;
+       ServicePtrs[(snum)]->bStoreDosAttributes = val;
+}
index d7dc63bb2fd746a0092481b9facde94c2b40da5f..33c75fffd53d0535297a7408a3e5fe43513d82de 100644 (file)
@@ -182,6 +182,7 @@ static BOOL get_ea_dos_attribute(connection_struct *conn, const char *path,SMB_S
                if ((errno != ENOTSUP) && (errno != ENOATTR) && (errno != EACCES)) {
                        DEBUG(1,("get_ea_dos_attributes: Cannot get attribute from EA on file %s: Error = %s\n",
                                path, strerror(errno) ));
+                       set_store_dos_attributes(SNUM(conn), False);
                }
 #endif
                return False;
@@ -224,9 +225,21 @@ static BOOL set_ea_dos_attribute(connection_struct *conn, const char *path, SMB_
        files_struct *fsp = NULL;
        BOOL ret = False;
 
+       if (!lp_store_dos_attributes(SNUM(conn))) {
+               return False;
+       }
+
        snprintf(attrstr, sizeof(attrstr)-1, "0x%x", dosmode & SAMBA_ATTRIBUTES_MASK);
        if (SMB_VFS_SETXATTR(conn, path, SAMBA_XATTR_DOS_ATTRIB, attrstr, strlen(attrstr), 0) == -1) {
                if((errno != EPERM) && (errno != EACCES)) {
+                       if (errno == ENOSYS
+#if defined(ENOTSUP)
+                               || errno == ENOTSUP) {
+#else
+                               ) {
+#endif
+                               set_store_dos_attributes(SNUM(conn), False);
+                       }
                        return False;
                }
 
index 12fd809b7849f95e23badc2255dab4c5c783b027..efbc66a0ac65b6ae6404a2b3e17774c8ae052ca6 100644 (file)
@@ -61,23 +61,24 @@ uint16 get_current_mid(void)
  for processing.
 ****************************************************************************/
 
-typedef struct {
-       ubi_slNode msg_next;
+struct pending_message_list {
+       struct pending_message_list *next, *prev;
        char *msg_buf;
        int msg_len;
-} pending_message_list;
+};
 
-static ubi_slList smb_oplock_queue = { NULL, (ubi_slNodePtr)&smb_oplock_queue, 0};
+static struct pending_message_list *smb_oplock_queue;
 
 /****************************************************************************
  Function to push a message onto the tail of a linked list of smb messages ready
  for processing.
 ****************************************************************************/
 
-static BOOL push_message(ubi_slList *list_head, char *buf, int msg_len)
+static BOOL push_message(struct pending_message_list *list_head, char *buf, int msg_len)
 {
-       pending_message_list *msg = (pending_message_list *)
-                               malloc(sizeof(pending_message_list));
+       struct pending_message_list *tmp_msg;
+       struct pending_message_list *msg = (struct pending_message_list *)
+                               malloc(sizeof(struct pending_message_list));
 
        if(msg == NULL) {
                DEBUG(0,("push_message: malloc fail (1)\n"));
@@ -94,7 +95,7 @@ static BOOL push_message(ubi_slList *list_head, char *buf, int msg_len)
        memcpy(msg->msg_buf, buf, msg_len);
        msg->msg_len = msg_len;
 
-       ubi_slAddTail( list_head, msg);
+       DLIST_ADD_END(list_head, msg, tmp_msg);
 
        /* Push the MID of this packet on the signing queue. */
        srv_defer_sign_response(SVAL(buf,smb_mid));
@@ -109,7 +110,7 @@ static BOOL push_message(ubi_slList *list_head, char *buf, int msg_len)
 
 BOOL push_oplock_pending_smb_message(char *buf, int msg_len)
 {
-       return push_message(&smb_oplock_queue, buf, msg_len);
+       return push_message(smb_oplock_queue, buf, msg_len);
 }
 
 /****************************************************************************
@@ -185,11 +186,12 @@ static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
         * Check to see if we already have a message on the smb queue.
         * If so - copy and return it.
         */
-       if(ubi_slCount(&smb_oplock_queue) != 0) {
-               pending_message_list *msg = (pending_message_list *)ubi_slRemHead(&smb_oplock_queue);
+       if(smb_oplock_queue != NULL) {
+               struct pending_message_list *msg = smb_oplock_queue;
                memcpy(buffer, msg->msg_buf, MIN(buffer_len, msg->msg_len));
   
                /* Free the message we just copied. */
+               DLIST_REMOVE(smb_oplock_queue, msg);
                SAFE_FREE(msg->msg_buf);
                SAFE_FREE(msg);