Package: davfs2
Version: 0.2.3-1
Severity: wishlist
Tags: patch

Hi,
the attached patch allows to give usernames/groupnames instead of uid
and gid for the uid and gid options, with this patch you can write:

mount.davfs http://foo/bar /mnt -ouid=admin,gid=src

instead of having to lookup the group and user by hand. This makes it
easier to integrate things into pam_mount, etc.
Cheers,
 -- Guido


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11.9-agx0
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)

Versions of packages davfs2 depends on:
ii  libc6                      2.3.2.ds1-22  GNU C Library: Shared libraries an
ii  libneon24                  0.24.7.dfsg-2 An HTTP and WebDAV client library
ii  libssl0.9.7                0.9.7g-1      SSL shared libraries
ii  libxml2                    2.6.16-7      GNOME XML library
ii  zlib1g                     1:1.2.2-4     compression library - runtime

-- no debconf information
--- bla/davfs2-0.2.3/src/util.c 2004-11-02 06:45:26.000000000 +0100
+++ davfs2-0.2.3/src/util.c     2005-05-27 13:36:05.000000000 +0200
@@ -25,6 +25,9 @@
 #include <errno.h>
 #include <termios.h>
 #include <unistd.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <grp.h>
 
 
 /* Neon */
@@ -125,12 +128,28 @@
     }
 
     if(!strcmp(name, "gid")) {
-       mopt->gid = atoi(value);
+       char* endp;
+       mopt->gid = strtol(value,&endp,10);
+       if(*endp != '\0') {
+           struct group* grp;
+           if( (grp = getgrnam(value)) )
+               mopt->gid = grp->gr_gid;
+           else
+               mopt->gid = 0;
+       }
        return 1;
     }
     
     if(!strcmp(name, "uid")) {
-       mopt->uid = atoi(value);
+       char* endp;
+       mopt->uid = strtol(value,&endp,10);
+       if(*endp != '\0') {
+           struct passwd* pw;
+           if( (pw=getpwnam(value)) )
+               mopt->uid = pw->pw_uid;
+           else
+               mopt->uid = 0;
+       }
        return 1;
     }
 

Reply via email to