Fix a bunch of compiler warnings about wrong format types.
[ira/wip.git] / source3 / modules / vfs_solarisacl.c
index b29c218ff4265e5dd44efac8edf6bdf0aebd7522..fbfe664c6ed504f62e789567131beb83ded86aa4 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Unix SMB/Netbios implementation.
    VFS module to get and set Solaris ACLs
-   Copyright (C) Michael Adam 2006
+   Copyright (C) Michael Adam 2006,2008
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -51,11 +51,12 @@ static bool solaris_add_to_acl(SOLARIS_ACL_T *solaris_acl, int *count,
 static bool solaris_acl_get_file(const char *name, SOLARIS_ACL_T *solarisacl, 
                int *count);
 static bool solaris_acl_get_fd(int fd, SOLARIS_ACL_T *solarisacl, int *count);
-static bool solaris_acl_sort(SOLARIS_ACL_T acl, int count);
+static bool solaris_acl_sort(SOLARIS_ACL_T theacl, int count);
 static SMB_ACL_PERM_T solaris_perm_to_smb_perm(const SOLARIS_PERM_T perm);
 static SOLARIS_PERM_T smb_perm_to_solaris_perm(const SMB_ACL_PERM_T perm);
+#if 0
 static bool solaris_acl_check(SOLARIS_ACL_T solaris_acl, int count);
-
+#endif
 
 /* public functions - the api */
 
@@ -100,8 +101,7 @@ SMB_ACL_T solarisacl_sys_acl_get_file(vfs_handle_struct *handle,
  * get the access ACL of a file referred to by a fd
  */
 SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
-                                   files_struct *fsp,
-                                   int fd)
+                                   files_struct *fsp)
 {
        SMB_ACL_T result = NULL;
        int count;
@@ -109,7 +109,7 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
 
        DEBUG(10, ("entering solarisacl_sys_acl_get_fd.\n"));
 
-       if (!solaris_acl_get_fd(fd, &solaris_acl, &count)) {
+       if (!solaris_acl_get_fd(fsp->fh->fd, &solaris_acl, &count)) {
                goto done;
        }
        /* 
@@ -128,7 +128,7 @@ SMB_ACL_T solarisacl_sys_acl_get_fd(vfs_handle_struct *handle,
        DEBUG(10, ("solarisacl_sys_acl_get_fd %s.\n", 
                   ((result == NULL) ? "failed" : "succeeded")));
        SAFE_FREE(solaris_acl);
-       return NULL;
+       return result;
 }
 
 int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
@@ -219,7 +219,7 @@ int solarisacl_sys_acl_set_file(vfs_handle_struct *handle,
  */
 int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                              files_struct *fsp,
-                             int fd, SMB_ACL_T theacl)
+                             SMB_ACL_T theacl)
 {
        SOLARIS_ACL_T solaris_acl = NULL;
        SOLARIS_ACL_T default_acl = NULL;
@@ -242,7 +242,7 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                           strerror(errno)));
                goto done;
        }
-       if (!solaris_acl_get_fd(fd, &default_acl, &default_count)) {
+       if (!solaris_acl_get_fd(fsp->fh->fd, &default_acl, &default_count)) {
                DEBUG(10, ("error getting (default) acl from fd\n"));
                goto done;
        }
@@ -258,14 +258,14 @@ int solarisacl_sys_acl_set_fd(vfs_handle_struct *handle,
                goto done;
        }
 
-       ret = facl(fd, SETACL, count, solaris_acl);
+       ret = facl(fsp->fh->fd, SETACL, count, solaris_acl);
        if (ret != 0) {
                DEBUG(10, ("call of facl failed (%s).\n", strerror(errno)));
        }
 
  done:
-       DEBUG(10, ("solarisacl_sys_acl_st_fd %s.\n",
-                  ((ret == 0) ? "succeded" : "failed" )));
+       DEBUG(10, ("solarisacl_sys_acl_set_fd %s.\n",
+                  ((ret == 0) ? "succeeded" : "failed" )));
        SAFE_FREE(solaris_acl);
        SAFE_FREE(default_acl);
        return ret;
@@ -348,7 +348,6 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl,
 {
        bool ret = False;
        int i;
-       int check_which, check_rc;
 
        DEBUG(10, ("entering smb_acl_to_solaris_acl\n"));
        
@@ -368,13 +367,13 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl,
                }
                switch(solaris_entry.a_type) {
                case USER:
-                       DEBUG(10, ("got tag type USER with uid %d\n", 
-                                  smb_entry->uid));
+                       DEBUG(10, ("got tag type USER with uid %u\n", 
+                                  (unsigned int)smb_entry->uid));
                        solaris_entry.a_id = (uid_t)smb_entry->uid;
                        break;
                case GROUP:
-                       DEBUG(10, ("got tag type GROUP with gid %d\n", 
-                                  smb_entry->gid));
+                       DEBUG(10, ("got tag type GROUP with gid %u\n", 
+                                  (unsigned int)smb_entry->gid));
                        solaris_entry.a_id = (uid_t)smb_entry->gid;
                        break;
                default:
@@ -389,7 +388,7 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl,
                        smb_perm_to_solaris_perm(smb_entry->a_perm);
                DEBUG(10, ("assembled the following solaris ace:\n"));
                DEBUGADD(10, (" - type: 0x%04x\n", solaris_entry.a_type));
-               DEBUGADD(10, (" - id: %d\n", solaris_entry.a_id));
+               DEBUGADD(10, (" - id: %u\n", (unsigned int)solaris_entry.a_id));
                DEBUGADD(10, (" - perm: o%o\n", solaris_entry.a_perm));
                if (!solaris_add_to_acl(solaris_acl, count, &solaris_entry, 
                                        1, type))
@@ -401,8 +400,8 @@ static bool smb_acl_to_solaris_acl(SMB_ACL_T smb_acl,
                DEBUG(10, ("test, if entry has been copied into acl:\n"));
                DEBUGADD(10, (" - type: 0x%04x\n",
                              (*solaris_acl)[(*count)-1].a_type));
-               DEBUGADD(10, (" - id: %d\n",
-                             (*solaris_acl)[(*count)-1].a_id));
+               DEBUGADD(10, (" - id: %u\n",
+                             (unsigned int)(*solaris_acl)[(*count)-1].a_id));
                DEBUGADD(10, (" - perm: o%o\n",
                              (*solaris_acl)[(*count)-1].a_perm));
        }
@@ -718,6 +717,7 @@ static bool solaris_acl_sort(SOLARIS_ACL_T solaris_acl, int count)
        return True;
 }
 
+#if 0
 /*
  * acl check function:
  *   unused at the moment but could be used to get more
@@ -747,7 +747,7 @@ static bool solaris_acl_check(SOLARIS_ACL_T solaris_acl, int count)
        }
        return True;
 }
-
+#endif
 
 /* VFS operations structure */