The Samba-Bugzilla – Attachment 2811 Details for
Bug 4780
mount.cifs: user mount should imply uid=,gid= by default
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for sensible uid= default for mount.cifs
linux-cifs-user-perms.patch (text/plain), 2.47 KB, created by
Steve Langasek
on 2007-07-12 01:12:47 UTC
(
hide
)
Description:
Patch for sensible uid= default for mount.cifs
Filename:
MIME Type:
Creator:
Steve Langasek
Created:
2007-07-12 01:12:47 UTC
Size:
2.47 KB
patch
obsolete
>Index: samba-3.0.25b/source/client/mount.cifs.c >=================================================================== >--- samba-3.0.25b.orig/source/client/mount.cifs.c 2007-07-11 19:54:30.000000000 -0700 >+++ samba-3.0.25b/source/client/mount.cifs.c 2007-07-11 20:17:40.000000000 -0700 >@@ -321,6 +321,8 @@ > int out_len = 0; > int word_len; > int rc = 0; >+ char user[32]; >+ char group[32]; > > if (!optionsp || !*optionsp) > return 1; >@@ -331,6 +333,13 @@ > > /* BB fixme check for separator override BB */ > >+ if (getuid()) { >+ got_uid = 1; >+ sprintf(user,"%u",getuid()); >+ got_gid = 1; >+ sprintf(group,"%u",getgid()); >+ } >+ > /* while ((data = strsep(&options, ",")) != NULL) { */ > while(data != NULL) { > /* check if ends with trailing comma */ >@@ -493,33 +502,35 @@ > got_uid = 1; > if (!isdigit(*value)) { > struct passwd *pw; >- static char temp[32]; > > if (!(pw = getpwnam(value))) { > printf("bad user name \"%s\"\n", value); > exit(1); > } >- sprintf(temp, "%u", pw->pw_uid); >- value = temp; >+ sprintf(user, "%u", pw->pw_uid); > endpwent(); >+ } else { >+ strcpy(user,value); > } > } >+ goto nocopy; > } else if (strncmp(data, "gid", 3) == 0) { > if (value && *value) { > got_gid = 1; > if (!isdigit(*value)) { > struct group *gr; >- static char temp[32]; > > if (!(gr = getgrnam(value))) { > printf("bad group name \"%s\"\n", value); > exit(1); > } >- sprintf(temp, "%u", gr->gr_gid); >- value = temp; >+ sprintf(group, "%u", gr->gr_gid); > endpwent(); >+ } else { >+ strcpy(group,value); > } > } >+ goto nocopy; > /* fmask and dmask synonyms for people used to smbfs syntax */ > } else if (strcmp(data, "file_mode") == 0 || strcmp(data, "fmask")==0) { > if (!value || !*value) { >@@ -621,6 +632,37 @@ > nocopy: > data = next_keyword; > } >+ >+ // special-case the uid and gid >+ if (got_uid) { >+ word_len = strlen(user); >+ >+ out = (char *)realloc(out, out_len + word_len + 6); >+ if (out == NULL) { >+ perror("malloc"); >+ exit(1); >+ } >+ >+ if (out_len) >+ out[out_len++] = ','; >+ sprintf(out + out_len, "uid=%s", user); >+ out_len = strlen(out); >+ } >+ if (got_gid) { >+ word_len = strlen(group); >+ >+ out = (char *)realloc(out, out_len + word_len + 6); >+ if (out == NULL) { >+ perror("malloc"); >+ exit(1); >+ } >+ >+ if (out_len) >+ out[out_len++] = ','; >+ sprintf(out + out_len, "gid=%s", group); >+ out_len = strlen(out); >+ } >+ > free(*optionsp); > *optionsp = out; > return 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 4780
: 2811