[SCM] Samba Shared Repository - branch master updated - 2c9df6401c4b5cbd49c67c86c58f0515426846bb

2008-10-09 Thread Jeff Layton
The branch, master has been updated
   via  2c9df6401c4b5cbd49c67c86c58f0515426846bb (commit)
   via  dd9002cf498e177b769eabd2fed40213069cd239 (commit)
  from  eb78e5c46f2ceb1de9cdd459f024d0632ef90893 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 2c9df6401c4b5cbd49c67c86c58f0515426846bb
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Oct 9 09:58:40 2008 -0400

mount.cifs: make return codes match the return codes for /bin/mount (try #3)

The manpage for /bin/mount specifies that the return code should be a
positive integer (actually, it's a bitfield). Clean up the return
codes from mount.cifs to make them match the expected return values
from /bin/mount. This necessary for proper integration with autofs.

This is the third attempt at this patch. The changes here are minor,
just changing some return's from main() into exit() calls for
consistency's sake.
    
    Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

commit dd9002cf498e177b769eabd2fed40213069cd239
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Oct 9 09:58:39 2008 -0400

mount.cifs: have uppercase_string return success on NULL pointer

We currently don't attempt to uppercase the device portion of the mount
string if there isn't a prefixpath. Fix that by making uppercase_string
return success without doing anything on a NULL pointer.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

---

Summary of changes:
 source3/client/mount.cifs.c |   86 ---
 1 files changed, 48 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index b7a76c6..fd8014c 100644
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -79,6 +79,15 @@
 #define MOUNT_PASSWD_SIZE 64
 #define DOMAIN_SIZE 64
 
+/* exit status - bits below are ORed */
+#define EX_USAGE1   /* incorrect invocation or permission */
+#define EX_SYSERR   2   /* out of memory, cannot fork, ... */
+#define EX_SOFTWARE 4   /* internal mount bug or wrong version */
+#define EX_USER 8   /* user interrupt */
+#define EX_FILEIO  16   /* problems writing, locking, ... mtab/fstab */
+#define EX_FAIL32   /* mount failure */
+#define EX_SOMEOK  64   /* some mount succeeded */
+
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -174,7 +183,7 @@ static void mount_cifs_usage(void)
printf("\n\t%s -V\n",thisprogram);
 
SAFE_FREE(mountpassword);
-   exit(1);
+   exit(EX_USAGE);
 }
 
 /* caller frees username if necessary */
@@ -233,7 +242,7 @@ static int open_cred_file(char * file_name)
if(length > 4086) {
printf("mount.cifs failed due to 
malformed username in credentials file");
memset(line_buf,0,4096);
-   exit(1);
+   exit(EX_USAGE);
} else {
got_user = 1;
user_name = (char *)calloc(1 + 
length,1);
@@ -257,7 +266,7 @@ static int open_cred_file(char * file_name)
if(length > MOUNT_PASSWD_SIZE) {
printf("mount.cifs failed: password in 
credentials file too long\n");
memset(line_buf,0, 4096);
-   exit(1);
+   exit(EX_USAGE);
} else {
if(mountpassword == NULL) {
mountpassword = (char 
*)calloc(MOUNT_PASSWD_SIZE+1,1);
@@ -285,7 +294,7 @@ static int open_cred_file(char * file_name)
 }
 if(length > DOMAIN_SIZE) {
 printf("mount.cifs failed: domain in 
credentials file too long\n");
-exit(1);
+exit(EX_USAGE);
 } else {
 if(domain_name == NULL) {
 domain_name = (char 
*)calloc(DOMAIN_SIZE+1,1);
@@ -318,7 +327,7 @@ static int get_password_from_file(int file_descript, char * 
filename)
 
if (mountpassword == NULL) {
printf("malloc failed\n");
-   exit(1);
+   exit(EX_S

[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3082-g2374799

2008-10-09 Thread Jeff Layton
The branch, v3-2-test has been updated
   via  2374799c8114ae3ed422d1cbe4ca12c4fd075274 (commit)
   via  34b5cfe8a0cb8674da0c5ac7d81b6e64160ccaa2 (commit)
  from  ce8de496ec139b7a56db20c5ffbcbdc2f4db0a51 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 2374799c8114ae3ed422d1cbe4ca12c4fd075274
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Oct 9 10:44:37 2008 -0400

mount.cifs: make return codes match the return codes for /bin/mount (try #3)

The manpage for /bin/mount specifies that the return code should be a
positive integer (actually, it's a bitfield). Clean up the return
codes from mount.cifs to make them match the expected return values
from /bin/mount. This necessary for proper integration with autofs.

This is the third attempt at this patch. The changes here are minor,
just changing some return's from main() into exit() calls for
consistency's sake.
    
    Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

commit 34b5cfe8a0cb8674da0c5ac7d81b6e64160ccaa2
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Oct 9 10:42:28 2008 -0400

mount.cifs: have uppercase_string return success on NULL pointer

We currently don't attempt to uppercase the device portion of the mount
string if there isn't a prefixpath. Fix that by making uppercase_string
return success without doing anything on a NULL pointer.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

---

Summary of changes:
 source/client/mount.cifs.c |   86 ---
 1 files changed, 48 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 56778dd..9278295 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -79,6 +79,15 @@
 #define MOUNT_PASSWD_SIZE 64
 #define DOMAIN_SIZE 64
 
+/* exit status - bits below are ORed */
+#define EX_USAGE1   /* incorrect invocation or permission */
+#define EX_SYSERR   2   /* out of memory, cannot fork, ... */
+#define EX_SOFTWARE 4   /* internal mount bug or wrong version */
+#define EX_USER 8   /* user interrupt */
+#define EX_FILEIO  16   /* problems writing, locking, ... mtab/fstab */
+#define EX_FAIL32   /* mount failure */
+#define EX_SOMEOK  64   /* some mount succeeded */
+
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -174,7 +183,7 @@ static void mount_cifs_usage(void)
printf("\n\t%s -V\n",thisprogram);
 
SAFE_FREE(mountpassword);
-   exit(1);
+   exit(EX_USAGE);
 }
 
 /* caller frees username if necessary */
@@ -233,7 +242,7 @@ static int open_cred_file(char * file_name)
if(length > 4086) {
printf("mount.cifs failed due to 
malformed username in credentials file");
memset(line_buf,0,4096);
-   exit(1);
+   exit(EX_USAGE);
} else {
got_user = 1;
user_name = (char *)calloc(1 + 
length,1);
@@ -257,7 +266,7 @@ static int open_cred_file(char * file_name)
if(length > MOUNT_PASSWD_SIZE) {
printf("mount.cifs failed: password in 
credentials file too long\n");
memset(line_buf,0, 4096);
-   exit(1);
+   exit(EX_USAGE);
} else {
if(mountpassword == NULL) {
mountpassword = (char 
*)calloc(MOUNT_PASSWD_SIZE+1,1);
@@ -285,7 +294,7 @@ static int open_cred_file(char * file_name)
 }
 if(length > DOMAIN_SIZE) {
 printf("mount.cifs failed: domain in 
credentials file too long\n");
-exit(1);
+exit(EX_USAGE);
 } else {
 if(domain_name == NULL) {
 domain_name = (char 
*)calloc(DOMAIN_SIZE+1,1);
@@ -318,7 +327,7 @@ static int get_password_from_file(int file_descript, char * 
filename)
 
if (mountpassword == NULL) {
printf("malloc failed\n");
-   exit(1);
+   exit(EX_S

[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4241-ga6e250a

2008-10-09 Thread Jeff Layton
The branch, v3-3-test has been updated
   via  a6e250ad2f50ec1c083a86d0161c1c00c1c3129e (commit)
   via  1c9f269280983119c7c906bbc2bf1ccaaba8c740 (commit)
  from  f953fd62f7e4d4d18eb4d713989eacce630c4949 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -
commit a6e250ad2f50ec1c083a86d0161c1c00c1c3129e
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Oct 9 10:46:40 2008 -0400

mount.cifs: make return codes match the return codes for /bin/mount (try #3)

The manpage for /bin/mount specifies that the return code should be a
positive integer (actually, it's a bitfield). Clean up the return
codes from mount.cifs to make them match the expected return values
from /bin/mount. This necessary for proper integration with autofs.

This is the third attempt at this patch. The changes here are minor,
just changing some return's from main() into exit() calls for
consistency's sake.
    
    Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

commit 1c9f269280983119c7c906bbc2bf1ccaaba8c740
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Oct 9 10:46:40 2008 -0400

mount.cifs: have uppercase_string return success on NULL pointer

We currently don't attempt to uppercase the device portion of the mount
string if there isn't a prefixpath. Fix that by making uppercase_string
return success without doing anything on a NULL pointer.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

---

Summary of changes:
 source/client/mount.cifs.c |   86 ---
 1 files changed, 48 insertions(+), 38 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index b7a76c6..fd8014c 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -79,6 +79,15 @@
 #define MOUNT_PASSWD_SIZE 64
 #define DOMAIN_SIZE 64
 
+/* exit status - bits below are ORed */
+#define EX_USAGE1   /* incorrect invocation or permission */
+#define EX_SYSERR   2   /* out of memory, cannot fork, ... */
+#define EX_SOFTWARE 4   /* internal mount bug or wrong version */
+#define EX_USER 8   /* user interrupt */
+#define EX_FILEIO  16   /* problems writing, locking, ... mtab/fstab */
+#define EX_FAIL32   /* mount failure */
+#define EX_SOMEOK  64   /* some mount succeeded */
+
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -174,7 +183,7 @@ static void mount_cifs_usage(void)
printf("\n\t%s -V\n",thisprogram);
 
SAFE_FREE(mountpassword);
-   exit(1);
+   exit(EX_USAGE);
 }
 
 /* caller frees username if necessary */
@@ -233,7 +242,7 @@ static int open_cred_file(char * file_name)
if(length > 4086) {
printf("mount.cifs failed due to 
malformed username in credentials file");
memset(line_buf,0,4096);
-   exit(1);
+   exit(EX_USAGE);
} else {
got_user = 1;
user_name = (char *)calloc(1 + 
length,1);
@@ -257,7 +266,7 @@ static int open_cred_file(char * file_name)
if(length > MOUNT_PASSWD_SIZE) {
printf("mount.cifs failed: password in 
credentials file too long\n");
memset(line_buf,0, 4096);
-   exit(1);
+   exit(EX_USAGE);
} else {
if(mountpassword == NULL) {
mountpassword = (char 
*)calloc(MOUNT_PASSWD_SIZE+1,1);
@@ -285,7 +294,7 @@ static int open_cred_file(char * file_name)
 }
 if(length > DOMAIN_SIZE) {
 printf("mount.cifs failed: domain in 
credentials file too long\n");
-exit(1);
+exit(EX_USAGE);
 } else {
 if(domain_name == NULL) {
 domain_name = (char 
*)calloc(DOMAIN_SIZE+1,1);
@@ -318,7 +327,7 @@ static int get_password_from_file(int file_descript, char * 
filename)
 
if (mountpassword == NULL) {
printf("malloc failed\n");
-   exit(1);
+   exit(EX_S

[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-32-46-g4558c09

2008-10-09 Thread Jeff Layton
The branch, v3-0-test has been updated
   via  4558c09c921793dd358de3ad4b9b4dd091e43662 (commit)
   via  41849ee120297b845ef288c76b45d039ad04112d (commit)
  from  cfa9d20db78875969ea8065161f8efdf5281d003 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -
commit 4558c09c921793dd358de3ad4b9b4dd091e43662
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Oct 9 10:51:33 2008 -0400

mount.cifs: make return codes match the return codes for /bin/mount (try #3)

The manpage for /bin/mount specifies that the return code should be a
positive integer (actually, it's a bitfield). Clean up the return
codes from mount.cifs to make them match the expected return values
from /bin/mount. This necessary for proper integration with autofs.

This is the third attempt at this patch. The changes here are minor,
just changing some return's from main() into exit() calls for
consistency's sake.
    
    Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

commit 41849ee120297b845ef288c76b45d039ad04112d
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Oct 9 10:47:45 2008 -0400

mount.cifs: have uppercase_string return success on NULL pointer

We currently don't attempt to uppercase the device portion of the mount
string if there isn't a prefixpath. Fix that by making uppercase_string
return success without doing anything on a NULL pointer.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

---

Summary of changes:
 source/client/mount.cifs.c |   88 ---
 1 files changed, 49 insertions(+), 39 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 0d27c05..c97e938 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -68,6 +68,15 @@
 
 #define CONST_DISCARD(type, ptr)  ((type) ((void *) (ptr)))
 
+/* exit status - bits below are ORed */
+#define EX_USAGE1   /* incorrect invocation or permission */
+#define EX_SYSERR   2   /* out of memory, cannot fork, ... */
+#define EX_SOFTWARE 4   /* internal mount bug or wrong version */
+#define EX_USER 8   /* user interrupt */
+#define EX_FILEIO  16   /* problems writing, locking, ... mtab/fstab */
+#define EX_FAIL32   /* mount failure */
+#define EX_SOMEOK  64   /* some mount succeeded */
+
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -159,7 +168,7 @@ static void mount_cifs_usage(void)
free(mountpassword);
mountpassword = NULL;
}
-   exit(1);
+   exit(EX_USAGE);
 }
 
 /* caller frees username if necessary */
@@ -220,7 +229,7 @@ static int open_cred_file(char * file_name)
if(mountpassword) {
memset(mountpassword,0,64);
}
-   exit(1);
+   exit(EX_USAGE);
} else {
got_user = 1;
user_name = (char *)calloc(1 + 
length,1);
@@ -246,7 +255,7 @@ static int open_cred_file(char * file_name)
if(mountpassword) {
memset(mountpassword,0,64);
}
-   exit(1);
+   exit(EX_USAGE);
} else {
if(mountpassword == NULL) {
mountpassword = (char 
*)calloc(65,1);
@@ -276,7 +285,7 @@ static int open_cred_file(char * file_name)
 if(mountpassword) {
 memset(mountpassword,0,64);
 }
-exit(1);
+exit(EX_USAGE);
 } else {
 if(domain_name == NULL) {
 domain_name = (char 
*)calloc(65,1);
@@ -313,7 +322,7 @@ static int get_password_from_file(int file_descript, char * 
filename)
 
if (mountpassword == NULL) {
printf("malloc failed\n");
-   exit(1);
+   exit(EX_SYSERR);
}
 
if(filename != NULL) {
@@ -321,7 +330,7 @@ static int get_password_from_file(int file_descript, char * 
filename)
if(file_descript < 0) {
prin

[SCM] Samba Website Repository - branch master updated

2013-08-09 Thread Jeff Layton
The branch, master has been updated
   via  2388470 Update team page listing for Jeff Layton
  from  5f760ab Announce Samba 4.1.0rc2.

http://gitweb.samba.org/?p=samba-web.git;a=shortlog;h=master


- Log -
commit 2388470d2fbe940fe36f5521d35e2ebc5cd37880
Author: Jeff Layton 
Date:   Fri Aug 9 09:57:11 2013 -0400

Update team page listing for Jeff Layton

Signed-off-by: Jeff Layton 

---

Summary of changes:
 team/index.html |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/team/index.html b/team/index.html
index ee7634d..fe7d443 100755
--- a/team/index.html
+++ b/team/index.html
@@ -66,7 +66,7 @@ mailing list and start contributing to the development of 
Samba.
 http://www.j3e.de/";>Björn Jacke
 mailto:mkap...@samba.org";>Marc Kaplan
 mailto:ku...@samba.org";>Günter Kukkukk
-mailto:jlay...@samba.org";>Jeff Layton
+http://www.samba.org/~jlayton/jlayton_resume.html";>Jeff 
Layton
 mailto:vlen...@samba.org";>Volker Lendecke
 mailto:h...@samba.org";>Herb Lewis
 


-- 
Samba Website Repository


[SCM] Samba Shared Repository - branch master updated

2009-11-11 Thread Jeff Layton
The branch, master has been updated
   via  b11e11a... mount.cifs: get rid of CONST_DISCARD
  from  f3646ff... s3/docs: Document "enable spoolss".

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit b11e11a9737a6490f27f9ea5c15b39203fbcbe7a
Author: Jeff Layton 
Date:   Wed Nov 11 14:04:54 2009 -0500

mount.cifs: get rid of CONST_DISCARD

Apparently, we need to strip the "const" attribute off of the mnt_fstype
before passing it to addmntent to prevent a (somewhat bogus) compiler
warning.

Rather than just stripping off the "const" attribute, clarify the code
by declaring a new non-const char pointer that points to the same
string. We can also use that same pointer in the mount(2) call too.

Signed-off-by: Jeff Layton 
Acked-by: Matthias Dieter Wallnöfer 

---

Summary of changes:
 client/mount.cifs.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/mount.cifs.c b/client/mount.cifs.c
index 3baaad7..a9c1827 100644
--- a/client/mount.cifs.c
+++ b/client/mount.cifs.c
@@ -76,8 +76,6 @@
 
 #define MAX_UNC_LEN 1024
 
-#define CONST_DISCARD(type, ptr)  ((type) ((void *) (ptr)))
-
 #ifndef SAFE_FREE
 #define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
 #endif
@@ -123,6 +121,7 @@ static char * user_name = NULL;
 static char * mountpassword = NULL;
 char * domain_name = NULL;
 char * prefixpath = NULL;
+char *cifs_fstype = "cifs";
 
 /* glibc doesn't have strlcpy, strlcat. Ensure we do. JRA. We
  * don't link to libreplace so need them here. */
@@ -1590,7 +1589,7 @@ mount_retry:
if (verboseflag)
fprintf(stderr, "\n");
 
-   if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
+   if (!fakemnt && mount(dev_name, mountpoint, cifs_fstype, flags, 
options)) {
switch (errno) {
case ECONNREFUSED:
case EHOSTUNREACH:
@@ -1638,7 +1637,7 @@ mount_retry:
}
mountent.mnt_fsname = dev_name;
mountent.mnt_dir = mountpoint;
-   mountent.mnt_type = CONST_DISCARD(char *,"cifs");
+   mountent.mnt_type = cifs_fstype;
mountent.mnt_opts = (char *)malloc(220);
if(mountent.mnt_opts) {
char * mount_user = getusername();


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2009-12-23 Thread Jeff Layton
The branch, master has been updated
   via  29a8467... doc: update mount.cifs man page with nounix option
  from  7e8b042... s4:ldb Fix declaration in the middle of the code

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 29a84670a9fa1fa461e669ac61c35cb3d03c362a
Author: Suresh Jayaraman 
Date:   Wed Dec 23 11:41:39 2009 -0500

doc: update mount.cifs man page with nounix option

Change since last post:
- fix build error due to superfluous  tag.
- ensure it builds fine.

Also add a section on INODE NUMBERS that discusses inode numbers more
thoroughly and add reference to it in "nounix" and "noserverino"
options.
    
Thanks to Jeff Layton for explaining those details.

Signed-off-by: Suresh Jayaraman 
    Signed-off-by: Jeff Layton 

---

Summary of changes:
 docs-xml/manpages-3/mount.cifs.8.xml |   54 -
 1 files changed, 52 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/mount.cifs.8.xml 
b/docs-xml/manpages-3/mount.cifs.8.xml
index 372b477..d930600 100644
--- a/docs-xml/manpages-3/mount.cifs.8.xml
+++ b/docs-xml/manpages-3/mount.cifs.8.xml
@@ -477,12 +477,35 @@ permissions in memory that can't be stored on the server. 
This information can d
 
 
 noserverino
-client generates inode numbers (rather than 
using the actual one
-from the server) by default.
+   
+   
+   Client generates inode numbers (rather than
+   using the actual one from the server) by default.
+   
+   
+   See section INODE NUMBERS for
+   more information.

 
 
 
+   nounix
+   
+   
+   Disable the CIFS Unix Extensions for this mount. This
+   can be useful in order to turn off multiple settings at once.
+   This includes POSIX acls, POSIX locks, POSIX paths, symlink
+   support and retrieving uids/gids/mode from the server. This
+   can also be useful to work around a bug in a server that
+   supports Unix Extensions.
+   
+   
+   See section INODE NUMBERS for
+   more information.
+
+
+
+
 nouser_xattr
 (default) Do not allow getfattr/setfattr to 
get/set xattrs, even if server would support it otherwise. 
 
@@ -533,6 +556,33 @@ permissions in memory that can't be stored on the server. 
This information can d
 
 
 
+   INODE NUMBERS
+   
+   When Unix Extensions are enabled, we use the actual inode
+   number provided by the server in response to the POSIX calls as an
+   inode number.
+   
+   
+   When Unix Extensions are disabled and "serverino" mount option
+   is enabled there is no way to get the server inode number. The
+   client typically maps the server-assigned "UniqueID" onto an inode
+   number.
+   
+   
+   Note that the UniqueID is a different value from the server
+   inode number. The UniqueID value is unique over the scope of the entire
+   server and is often greater than 2 power 32. This value often makes
+   programs that are not compiled with LFS (Large File Support), to
+   trigger a glibc EOVERFLOW error as this won't fit in the target
+   structure field. It is strongly recommended to compile your programs
+   with LFS support (i.e. with -D_FILE_OFFSET_BITS=64) to prevent this
+   problem. You can also use "noserverino" mount option to generate inode
+   numbers smaller than 2 power 32 on the client. But you may not be able
+   to detect hardlinks properly.
+   
+
+
+
FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS
 
 The core CIFS protocol does not provide unix ownership


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-5-test updated

2009-12-23 Thread Jeff Layton
The branch, v3-5-test has been updated
   via  091360d... doc: update mount.cifs man page with nounix option
  from  c8733d9... s3: wbinfo --ping-dc is not cacheable

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -
commit 091360d52fa2958f5f143aa3f0c4ce54d4fe120b
Author: Suresh Jayaraman 
Date:   Wed Dec 23 11:45:20 2009 -0500

doc: update mount.cifs man page with nounix option

Change since last post:
- fix build error due to superfluous  tag.
- ensure it builds fine.

Also add a section on INODE NUMBERS that discusses inode numbers more
thoroughly and add reference to it in "nounix" and "noserverino"
options.
    
Thanks to Jeff Layton for explaining those details.

Signed-off-by: Suresh Jayaraman 
    Signed-off-by: Jeff Layton 

---

Summary of changes:
 docs-xml/manpages-3/mount.cifs.8.xml |   54 -
 1 files changed, 52 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/mount.cifs.8.xml 
b/docs-xml/manpages-3/mount.cifs.8.xml
index 0beb968..c4fe2e8 100644
--- a/docs-xml/manpages-3/mount.cifs.8.xml
+++ b/docs-xml/manpages-3/mount.cifs.8.xml
@@ -477,12 +477,35 @@ permissions in memory that can't be stored on the server. 
This information can d
 
 
 noserverino
-client generates inode numbers (rather than 
using the actual one
-from the server) by default.
+   
+   
+   Client generates inode numbers (rather than
+   using the actual one from the server) by default.
+   
+   
+   See section INODE NUMBERS for
+   more information.

 
 
 
+   nounix
+   
+   
+   Disable the CIFS Unix Extensions for this mount. This
+   can be useful in order to turn off multiple settings at once.
+   This includes POSIX acls, POSIX locks, POSIX paths, symlink
+   support and retrieving uids/gids/mode from the server. This
+   can also be useful to work around a bug in a server that
+   supports Unix Extensions.
+   
+   
+   See section INODE NUMBERS for
+   more information.
+
+
+
+
 nouser_xattr
 (default) Do not allow getfattr/setfattr to 
get/set xattrs, even if server would support it otherwise. 
 
@@ -533,6 +556,33 @@ permissions in memory that can't be stored on the server. 
This information can d
 
 
 
+   INODE NUMBERS
+   
+   When Unix Extensions are enabled, we use the actual inode
+   number provided by the server in response to the POSIX calls as an
+   inode number.
+   
+   
+   When Unix Extensions are disabled and "serverino" mount option
+   is enabled there is no way to get the server inode number. The
+   client typically maps the server-assigned "UniqueID" onto an inode
+   number.
+   
+   
+   Note that the UniqueID is a different value from the server
+   inode number. The UniqueID value is unique over the scope of the entire
+   server and is often greater than 2 power 32. This value often makes
+   programs that are not compiled with LFS (Large File Support), to
+   trigger a glibc EOVERFLOW error as this won't fit in the target
+   structure field. It is strongly recommended to compile your programs
+   with LFS support (i.e. with -D_FILE_OFFSET_BITS=64) to prevent this
+   problem. You can also use "noserverino" mount option to generate inode
+   numbers smaller than 2 power 32 on the client. But you may not be able
+   to detect hardlinks properly.
+   
+
+
+
FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS
 
 The core CIFS protocol does not provide unix ownership


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2010-01-26 Thread Jeff Layton
The branch, master has been updated
   via  a0c31ec... mount.cifs: don't allow it to be run as setuid root 
program
   via  a065c17... mount.cifs: check for invalid characters in device name 
and mountpoint
   via  3ae5dac... mount.cifs: take extra care that mountpoint isn't 
changed during mount
  from  7148eff... s4-smbtorture: also test smbc_getOptionUseCCache

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit a0c31ec1c8d1220a5884e40d9ba6b191a04a24d5
Author: Jeff Layton 
Date:   Tue Jan 26 08:15:41 2010 -0500

mount.cifs: don't allow it to be run as setuid root program

mount.cifs has been the subject of several "security" fire drills due to
distributions installing it as a setuid root program. This program has
not been properly audited for security and the Samba team highly
recommends that it not be installed as a setuid root program at this
time.

To make that abundantly clear, this patch forcibly disables the ability
for mount.cifs to run as a setuid root program. People are welcome to
trivially patch this out, but they do so at their own peril.

A security audit and redesign of this program is in progress and we hope
that we'll be able to remove this in the near future.

Signed-off-by: Jeff Layton 

commit a065c177dfc8f968775593ba00dffafeebb2e054
Author: Jeff Layton 
Date:   Tue Jan 26 08:15:41 2010 -0500

mount.cifs: check for invalid characters in device name and mountpoint

It's apparently possible to corrupt the mtab if you pass embedded
newlines to addmntent. Apparently tabs are also a problem with certain
earlier glibc versions. Backslashes are also a minor issue apparently,
but we can't reasonably filter those.

Make sure that neither the devname or mountpoint contain any problematic
characters before allowing the mount to proceed.

Signed-off-by: Jeff Layton 

commit 3ae5dac462c4ed0fb2cd94553583c56fce2f9d80
Author: Jeff Layton 
Date:   Tue Jan 26 08:15:41 2010 -0500

mount.cifs: take extra care that mountpoint isn't changed during mount

It's possible to trick mount.cifs into mounting onto the wrong directory
by replacing the mountpoint with a symlink to a directory. mount.cifs
attempts to check the validity of the mountpoint, but there's still a
possible race between those checks and the mount(2) syscall.

To guard against this, chdir to the mountpoint very early, and only deal
with it as "." from then on out.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/mount.cifs.c |  107 ++
 1 files changed, 98 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/mount.cifs.c b/client/mount.cifs.c
index 459a9f3..9044184 100644
--- a/client/mount.cifs.c
+++ b/client/mount.cifs.c
@@ -43,7 +43,7 @@
 #include "mount.h"
 
 #define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "13"
+#define MOUNT_CIFS_VERSION_MINOR "14"
 
 #ifndef MOUNT_CIFS_VENDOR_SUFFIX
  #ifdef _SAMBA_BUILD_
@@ -87,6 +87,17 @@
 #define MAX_ADDRESS_LEN INET6_ADDRSTRLEN
 
 /*
+ * mount.cifs has been the subject of many "security" bugs that have arisen
+ * because of users and distributions installing it as a setuid root program.
+ * mount.cifs has not been audited for security. Thus, we strongly recommend
+ * that it not be installed setuid root. To make that abundantly clear,
+ * mount.cifs now check whether it's running setuid root and exit with an
+ * error if it is. If you wish to disable this check, then set the following
+ * #define to 1, but please realize that you do so at your own peril.
+ */
+#define CIFS_DISABLE_SETUID_CHECK 0
+
+/*
  * By default, mount.cifs follows the conventions set forth by /bin/mount
  * for user mounts. That is, it requires that the mount be listed in
  * /etc/fstab with the "user" option when run as an unprivileged user and
@@ -178,7 +189,7 @@ check_mountpoint(const char *progname, char *mountpoint)
struct stat statbuf;
 
/* does mountpoint exist and is it a directory? */
-   err = stat(mountpoint, &statbuf);
+   err = stat(".", &statbuf);
if (err) {
fprintf(stderr, "%s: failed to stat %s: %s\n", progname,
mountpoint, strerror(errno));
@@ -212,6 +223,29 @@ check_mountpoint(const char *progname, char *mountpoint)
return 0;
 }
 
+#if CIFS_DISABLE_SETUID_CHECK
+static int
+check_setuid(void)
+{
+   return 0;
+}
+#else /* CIFS_DISABLE_SETUID_CHECK */
+static int
+check_setuid(void)
+{
+   if (getuid() &&

[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1645-gb0c399c

2009-05-15 Thread Jeff Layton
The branch, master has been updated
   via  b0c399ce6015e8a96231d5e5e99e603d44e0cf57 (commit)
  from  d800ee50335ecbd2dbd3b451a18a00780ac28f04 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit b0c399ce6015e8a96231d5e5e99e603d44e0cf57
Author: Jeff Layton 
Date:   Fri May 15 14:31:28 2009 -0400

mount.cifs: directly include sys/stat.h in mtab.c

This file is mysteriously getting included when built via the makefile,
but when you try to build mtab.o by hand it fails to build. Directly
include it to remove any ambiguity.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 source3/client/mtab.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/mtab.c b/source3/client/mtab.c
index 93fbd11..70789bc 100644
--- a/source3/client/mtab.c
+++ b/source3/client/mtab.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - 32695912dd3ed7c02da68209328d630c89d395ba

2008-11-06 Thread Jeff Layton
The branch, master has been updated
   via  32695912dd3ed7c02da68209328d630c89d395ba (commit)
  from  db26f7b7c49b6d4254ce5da7097e062b7dbd0409 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 32695912dd3ed7c02da68209328d630c89d395ba
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Nov 6 15:07:07 2008 -0500

mount.cifs: use lock/unlock_mtab scheme from util-linux-ng mount prog

The util-linux-ng sources have a good, but rather complex scheme for
locking the mtab before updating it. Mount helpers need to follow the
same scheme. Advisory locking only works if everyone is using the same
locking scheme.

Copy the routines we need from util-linux-ng into a separate source file
and then have mount.cifs and umount.cifs link in this object.

The long term goal is to have these routines in a separate helper
library (libmount). Mount helpers can then dynamically link in that lib.
Until that happens, this should serve as a suitable stopgap solution.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

---

Summary of changes:
 source3/Makefile.in  |4 +-
 source3/client/mount.cifs.c  |   97 ++-
 source3/client/mount.h   |   38 +++
 source3/client/mtab.c|  219 ++
 source3/client/umount.cifs.c |   22 +
 5 files changed, 311 insertions(+), 69 deletions(-)
 create mode 100644 source3/client/mount.h
 create mode 100644 source3/client/mtab.c


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index 55306f1..4f757e9 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -904,9 +904,9 @@ CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
  $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
  $(LIBNDR_GEN_OBJ0)
 
-CIFS_MOUNT_OBJ = client/mount.cifs.o
+CIFS_MOUNT_OBJ = client/mount.cifs.o client/mtab.o
 
-CIFS_UMOUNT_OBJ = client/umount.cifs.o
+CIFS_UMOUNT_OBJ = client/umount.cifs.o client/mtab.o
 
 CIFS_UPCALL_OBJ = client/cifs.upcall.o
 
diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index 2a9c2b7..da2f98b 100644
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -39,9 +39,10 @@
 #include 
 #include 
 #include 
+#include "mount.h"
 
 #define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "11"
+#define MOUNT_CIFS_VERSION_MINOR "12"
 
 #ifndef MOUNT_CIFS_VENDOR_SUFFIX
  #ifdef _SAMBA_BUILD_
@@ -79,15 +80,6 @@
 #define MOUNT_PASSWD_SIZE 64
 #define DOMAIN_SIZE 64
 
-/* exit status - bits below are ORed */
-#define EX_USAGE1   /* incorrect invocation or permission */
-#define EX_SYSERR   2   /* out of memory, cannot fork, ... */
-#define EX_SOFTWARE 4   /* internal mount bug or wrong version */
-#define EX_USER 8   /* user interrupt */
-#define EX_FILEIO  16   /* problems writing, locking, ... mtab/fstab */
-#define EX_FAIL32   /* mount failure */
-#define EX_SOMEOK  64   /* some mount succeeded */
-
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -1424,48 +1416,57 @@ mount_retry:
printf("Refer to the mount.cifs(8) manual page (e.g.man 
mount.cifs)\n");
rc = EX_FAIL;
} else {
+   atexit(unlock_mtab);
+   rc = lock_mtab();
+   if (rc) {
+   printf("cannot lock mtab");
+   goto mount_exit;
+   }
pmntfile = setmntent(MOUNTED, "a+");
-   if(pmntfile) {
-   mountent.mnt_fsname = dev_name;
-   mountent.mnt_dir = mountpoint;
-   mountent.mnt_type = CONST_DISCARD(char *,"cifs");
-   mountent.mnt_opts = (char *)malloc(220);
-   if(mountent.mnt_opts) {
-   char * mount_user = getusername();
-   memset(mountent.mnt_opts,0,200);
-   if(flags & MS_RDONLY)
-   strlcat(mountent.mnt_opts,"ro",220);
-   else
-   strlcat(mountent.mnt_opts,"rw",220);
-   if(flags & MS_MANDLOCK)
-   strlcat(mountent.mnt_opts,",mand",220);
-   if(flags & MS_NOEXEC)
-   
strlcat(mountent.mnt_opts,",noexec",220);
-   if(flags & MS_NOSUID)
-   
strlcat(moun

[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4344-g00bbd9d

2008-11-06 Thread Jeff Layton
The branch, v3-3-test has been updated
   via  00bbd9dc6598acb9ef8adab4308ada6bb1818f1f (commit)
  from  7cbbcc75a834179d1c4841170d7cb7d41726 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -
commit 00bbd9dc6598acb9ef8adab4308ada6bb1818f1f
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Nov 6 15:13:48 2008 -0500

mount.cifs: use lock/unlock_mtab scheme from util-linux-ng mount prog

The util-linux-ng sources have a good, but rather complex scheme for
locking the mtab before updating it. Mount helpers need to follow the
same scheme. Advisory locking only works if everyone is using the same
locking scheme.

Copy the routines we need from util-linux-ng into a separate source file
and then have mount.cifs and umount.cifs link in this object.

The long term goal is to have these routines in a separate helper
library (libmount). Mount helpers can then dynamically link in that lib.
Until that happens, this should serve as a suitable stopgap solution.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

---

Summary of changes:
 source/Makefile.in  |4 +-
 source/client/mount.cifs.c  |   97 ++--
 source/client/mount.h   |   38 
 source/client/mtab.c|  219 +++
 source/client/umount.cifs.c |   22 +
 5 files changed, 311 insertions(+), 69 deletions(-)
 create mode 100644 source/client/mount.h
 create mode 100644 source/client/mtab.c


Changeset truncated at 500 lines:

diff --git a/source/Makefile.in b/source/Makefile.in
index db1a10f..448a413 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -883,9 +883,9 @@ CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
  $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
  $(LIBNDR_GEN_OBJ0)
 
-CIFS_MOUNT_OBJ = client/mount.cifs.o
+CIFS_MOUNT_OBJ = client/mount.cifs.o client/mtab.o
 
-CIFS_UMOUNT_OBJ = client/umount.cifs.o
+CIFS_UMOUNT_OBJ = client/umount.cifs.o client/mtab.o
 
 CIFS_UPCALL_OBJ = client/cifs.upcall.o
 
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 2a9c2b7..da2f98b 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -39,9 +39,10 @@
 #include 
 #include 
 #include 
+#include "mount.h"
 
 #define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "11"
+#define MOUNT_CIFS_VERSION_MINOR "12"
 
 #ifndef MOUNT_CIFS_VENDOR_SUFFIX
  #ifdef _SAMBA_BUILD_
@@ -79,15 +80,6 @@
 #define MOUNT_PASSWD_SIZE 64
 #define DOMAIN_SIZE 64
 
-/* exit status - bits below are ORed */
-#define EX_USAGE1   /* incorrect invocation or permission */
-#define EX_SYSERR   2   /* out of memory, cannot fork, ... */
-#define EX_SOFTWARE 4   /* internal mount bug or wrong version */
-#define EX_USER 8   /* user interrupt */
-#define EX_FILEIO  16   /* problems writing, locking, ... mtab/fstab */
-#define EX_FAIL32   /* mount failure */
-#define EX_SOMEOK  64   /* some mount succeeded */
-
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -1424,48 +1416,57 @@ mount_retry:
printf("Refer to the mount.cifs(8) manual page (e.g.man 
mount.cifs)\n");
rc = EX_FAIL;
} else {
+   atexit(unlock_mtab);
+   rc = lock_mtab();
+   if (rc) {
+   printf("cannot lock mtab");
+   goto mount_exit;
+   }
pmntfile = setmntent(MOUNTED, "a+");
-   if(pmntfile) {
-   mountent.mnt_fsname = dev_name;
-   mountent.mnt_dir = mountpoint;
-   mountent.mnt_type = CONST_DISCARD(char *,"cifs");
-   mountent.mnt_opts = (char *)malloc(220);
-   if(mountent.mnt_opts) {
-   char * mount_user = getusername();
-   memset(mountent.mnt_opts,0,200);
-   if(flags & MS_RDONLY)
-   strlcat(mountent.mnt_opts,"ro",220);
-   else
-   strlcat(mountent.mnt_opts,"rw",220);
-   if(flags & MS_MANDLOCK)
-   strlcat(mountent.mnt_opts,",mand",220);
-   if(flags & MS_NOEXEC)
-   
strlcat(mountent.mnt_opts,",noexec",220);
-   if(flags & MS_NOSUID)
-   
strlcat(mountent.mnt

[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3132-gecabc19

2008-11-06 Thread Jeff Layton
The branch, v3-2-test has been updated
   via  ecabc19a114657f38c48a19073eb970338f97010 (commit)
  from  ab984c93a2b197368ad21cfa0982ac2438ec57bf (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit ecabc19a114657f38c48a19073eb970338f97010
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Nov 6 15:15:57 2008 -0500

mount.cifs: use lock/unlock_mtab scheme from util-linux-ng mount prog

The util-linux-ng sources have a good, but rather complex scheme for
locking the mtab before updating it. Mount helpers need to follow the
same scheme. Advisory locking only works if everyone is using the same
locking scheme.

Copy the routines we need from util-linux-ng into a separate source file
and then have mount.cifs and umount.cifs link in this object.

The long term goal is to have these routines in a separate helper
library (libmount). Mount helpers can then dynamically link in that lib.
Until that happens, this should serve as a suitable stopgap solution.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

---

Summary of changes:
 source/Makefile.in  |4 +-
 source/client/mount.cifs.c  |   97 ++--
 source/client/mount.h   |   38 
 source/client/mtab.c|  219 +++
 source/client/umount.cifs.c |   22 +
 5 files changed, 311 insertions(+), 69 deletions(-)
 create mode 100644 source/client/mount.h
 create mode 100644 source/client/mtab.c


Changeset truncated at 500 lines:

diff --git a/source/Makefile.in b/source/Makefile.in
index 45ebb3c..f5811af 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -851,9 +851,9 @@ CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
  $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
  $(LIBNDR_GEN_OBJ0)
 
-CIFS_MOUNT_OBJ = client/mount.cifs.o
+CIFS_MOUNT_OBJ = client/mount.cifs.o client/mtab.o
 
-CIFS_UMOUNT_OBJ = client/umount.cifs.o
+CIFS_UMOUNT_OBJ = client/umount.cifs.o client/mtab.o
 
 CIFS_UPCALL_OBJ = client/cifs.upcall.o
 
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index ce13b88..2e059e8 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -39,9 +39,10 @@
 #include 
 #include 
 #include 
+#include "mount.h"
 
 #define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "11"
+#define MOUNT_CIFS_VERSION_MINOR "12"
 
 #ifndef MOUNT_CIFS_VENDOR_SUFFIX
  #ifdef _SAMBA_BUILD_
@@ -79,15 +80,6 @@
 #define MOUNT_PASSWD_SIZE 64
 #define DOMAIN_SIZE 64
 
-/* exit status - bits below are ORed */
-#define EX_USAGE1   /* incorrect invocation or permission */
-#define EX_SYSERR   2   /* out of memory, cannot fork, ... */
-#define EX_SOFTWARE 4   /* internal mount bug or wrong version */
-#define EX_USER 8   /* user interrupt */
-#define EX_FILEIO  16   /* problems writing, locking, ... mtab/fstab */
-#define EX_FAIL32   /* mount failure */
-#define EX_SOMEOK  64   /* some mount succeeded */
-
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -1420,48 +1412,57 @@ mount_retry:
printf("Refer to the mount.cifs(8) manual page (e.g.man 
mount.cifs)\n");
rc = EX_FAIL;
} else {
+   atexit(unlock_mtab);
+   rc = lock_mtab();
+   if (rc) {
+   printf("cannot lock mtab");
+   goto mount_exit;
+   }
pmntfile = setmntent(MOUNTED, "a+");
-   if(pmntfile) {
-   mountent.mnt_fsname = dev_name;
-   mountent.mnt_dir = mountpoint;
-   mountent.mnt_type = CONST_DISCARD(char *,"cifs");
-   mountent.mnt_opts = (char *)malloc(220);
-   if(mountent.mnt_opts) {
-   char * mount_user = getusername();
-   memset(mountent.mnt_opts,0,200);
-   if(flags & MS_RDONLY)
-   strlcat(mountent.mnt_opts,"ro",220);
-   else
-   strlcat(mountent.mnt_opts,"rw",220);
-   if(flags & MS_MANDLOCK)
-   strlcat(mountent.mnt_opts,",mand",220);
-   if(flags & MS_NOEXEC)
-   
strlcat(mountent.mnt_opts,",noexec",220);
-   if(flags & MS_NOSUID)
-   
strlcat(mountent.mnt

[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-32-62-g66ec780

2008-11-06 Thread Jeff Layton
The branch, v3-0-test has been updated
   via  66ec780d878979a9fa33ff868f1849e9d2166dcf (commit)
  from  0de73eeb1a17b6af217babd626b203eca975541f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -
commit 66ec780d878979a9fa33ff868f1849e9d2166dcf
Author: Jeff Layton <[EMAIL PROTECTED]>
Date:   Thu Nov 6 15:20:55 2008 -0500

mount.cifs: use lock/unlock_mtab scheme from util-linux-ng mount prog

The util-linux-ng sources have a good, but rather complex scheme for
locking the mtab before updating it. Mount helpers need to follow the
same scheme. Advisory locking only works if everyone is using the same
locking scheme.

Copy the routines we need from util-linux-ng into a separate source file
and then have mount.cifs and umount.cifs link in this object.

The long term goal is to have these routines in a separate helper
library (libmount). Mount helpers can then dynamically link in that lib.
Until that happens, this should serve as a suitable stopgap solution.

Signed-off-by: Jeff Layton <[EMAIL PROTECTED]>

---

Summary of changes:
 source/Makefile.in  |4 +-
 source/client/mount.cifs.c  |  103 ++--
 source/client/mount.h   |   38 
 source/client/mtab.c|  219 +++
 source/client/umount.cifs.c |   22 +
 5 files changed, 314 insertions(+), 72 deletions(-)
 create mode 100644 source/client/mount.h
 create mode 100644 source/client/mtab.c


Changeset truncated at 500 lines:

diff --git a/source/Makefile.in b/source/Makefile.in
index c377ed1..80b2a11 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -642,9 +642,9 @@ MNT_OBJ = client/smbmnt.o $(VERSION_OBJ) $(LIBREPLACE_OBJ) 
$(SOCKET_WRAPPER_OBJ)
 
 UMOUNT_OBJ = client/smbumount.o $(SOCKET_WRAPPER_OBJ)
 
-CIFS_MOUNT_OBJ = client/mount.cifs.o
+CIFS_MOUNT_OBJ = client/mount.cifs.o client/mtab.o
 
-CIFS_UMOUNT_OBJ = client/umount.cifs.o
+CIFS_UMOUNT_OBJ = client/umount.cifs.o client/mtab.o
 
 CIFS_UPCALL_OBJ = client/cifs.upcall.o
 
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index c97e938..1ac1410 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -39,9 +39,10 @@
 #include 
 #include 
 #include 
+#include "mount.h"
 
 #define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "10"
+#define MOUNT_CIFS_VERSION_MINOR "12"
 
 #ifndef MOUNT_CIFS_VENDOR_SUFFIX
  #ifdef _SAMBA_BUILD_
@@ -68,15 +69,6 @@
 
 #define CONST_DISCARD(type, ptr)  ((type) ((void *) (ptr)))
 
-/* exit status - bits below are ORed */
-#define EX_USAGE1   /* incorrect invocation or permission */
-#define EX_SYSERR   2   /* out of memory, cannot fork, ... */
-#define EX_SOFTWARE 4   /* internal mount bug or wrong version */
-#define EX_USER 8   /* user interrupt */
-#define EX_FILEIO  16   /* problems writing, locking, ... mtab/fstab */
-#define EX_FAIL32   /* mount failure */
-#define EX_SOMEOK  64   /* some mount succeeded */
-
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -1409,51 +1401,60 @@ mount_retry:
printf("Refer to the mount.cifs(8) manual page (e.g.man 
mount.cifs)\n");
rc = EX_FAIL;
} else {
+   atexit(unlock_mtab);
+   rc = lock_mtab();
+   if (rc) {
+   printf("cannot lock mtab");
+   goto mount_exit;
+   }
pmntfile = setmntent(MOUNTED, "a+");
-   if(pmntfile) {
-   mountent.mnt_fsname = dev_name;
-   mountent.mnt_dir = mountpoint;
-   mountent.mnt_type = CONST_DISCARD(char *,"cifs");
-   mountent.mnt_opts = (char *)malloc(220);
-   if(mountent.mnt_opts) {
-   char * mount_user = getusername();
-   memset(mountent.mnt_opts,0,200);
-   if(flags & MS_RDONLY)
-   strlcat(mountent.mnt_opts,"ro",220);
-   else
-   strlcat(mountent.mnt_opts,"rw",220);
-   if(flags & MS_MANDLOCK)
-   strlcat(mountent.mnt_opts,",mand",220);
-   if(flags & MS_NOEXEC)
-   
strlcat(mountent.mnt_opts,",noexec",220);
-   if(flags & MS_NOSUID)
-   
strlcat(mountent.mnt

[SCM] Samba Shared Repository - branch master updated - 9069c849074bc13dda505d461be97dd6357637aa

2008-12-12 Thread Jeff Layton
The branch, master has been updated
   via  9069c849074bc13dda505d461be97dd6357637aa (commit)
  from  d1101dba79d65b0991668069b91946198f343ead (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 9069c849074bc13dda505d461be97dd6357637aa
Author: Jeff Layton 
Date:   Fri Dec 12 07:00:38 2008 -0500

mount.cifs: allow mounts to ipv6 capable servers

The current name resolution scheme in mount.cifs is IPv4 only. Expand
it to be protocol-independent. Also take advantage of the fact that
getaddrinfo() returns a list of addresses and have mount.cifs try each
in turn until it hits one that's reachable and allows the socket to
connect.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 source3/client/mount.cifs.c |  221 +++
 1 files changed, 120 insertions(+), 101 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index 0bc61ae..9f4d1d3 100644
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -80,6 +80,9 @@
 #define MOUNT_PASSWD_SIZE 64
 #define DOMAIN_SIZE 64
 
+/* currently maximum length of IPv6 address string */
+#define MAX_ADDRESS_LEN INET6_ADDRSTRLEN
+
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -189,12 +192,6 @@ static char * getusername(void) {
return username;
 }
 
-static char * parse_cifs_url(char * unc_name)
-{
-   printf("\nMounting cifs URL not implemented yet. Attempt to mount 
%s\n",unc_name);
-   return NULL;
-}
-
 static int open_cred_file(char * file_name)
 {
char * line_buf;
@@ -494,7 +491,7 @@ static int parse_options(char ** optionsp, int * 
filesys_flags)
} else if (strncmp(data, "ip", 2) == 0) {
if (!value || !*value) {
printf("target ip address argument missing");
-   } else if (strnlen(value, 35) < 35) {
+   } else if (strnlen(value, MAX_ADDRESS_LEN) <= 
MAX_ADDRESS_LEN) {
if(verboseflag)
printf("ip address %s override 
specified\n",value);
got_ip = 1;
@@ -882,23 +879,23 @@ static void replace_char(char *string, char from, char 
to, int maxlen)
 }
 
 /* Note that caller frees the returned buffer if necessary */
-static char * parse_server(char ** punc_name)
+static struct addrinfo *
+parse_server(char ** punc_name)
 {
char * unc_name = *punc_name;
int length = strnlen(unc_name, MAX_UNC_LEN);
char * share;
-   char * ipaddress_string = NULL;
-   struct hostent * host_entry = NULL;
-   struct in_addr server_ipaddr;
+   struct addrinfo *addrlist;
+   int rc;
 
if(length > (MAX_UNC_LEN - 1)) {
printf("mount error: UNC name too long");
return NULL;
}
-   if (strncasecmp("cifs://",unc_name,7) == 0)
-   return parse_cifs_url(unc_name+7);
-   if (strncasecmp("smb://",unc_name,6) == 0) {
-   return parse_cifs_url(unc_name+6);
+   if ((strncasecmp("cifs://", unc_name, 7) == 0) ||
+   (strncasecmp("smb://", unc_name, 6) == 0)) {
+   printf("\nMounting cifs URL not implemented yet. Attempt to 
mount %s\n", unc_name);
+   return NULL;
}
 
if(length < 3) {
@@ -939,7 +936,12 @@ continue_unc_parsing:
*share = 0;  /* temporarily terminate the 
string */
share += 1;
if(got_ip == 0) {
-   host_entry = gethostbyname(unc_name);
+   rc = getaddrinfo(unc_name, NULL, NULL, 
&addrlist);
+   if (rc != 0) {
+   printf("mount error: could not 
resolve address for %s: %s\n",
+   unc_name, 
gai_strerror(rc));
+   addrlist = NULL;
+   }
}
*(share - 1) = '/'; /* put delimiter back */
 
@@ -954,23 +956,9 @@ continue_unc_parsing:
printf("ip address specified 
explicitly\n");
return NULL;
}
-   if(host_entry == NULL) {
-   printf("mount error: cou

[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4665-g4f19e08

2008-12-12 Thread Jeff Layton
The branch, v3-3-test has been updated
   via  4f19e0850bb457b41ea2953ca0d4e9aeaf3bc09a (commit)
  from  a42b38b34d4e97d2c196e67aef3b01d4f043b646 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -
commit 4f19e0850bb457b41ea2953ca0d4e9aeaf3bc09a
Author: Jeff Layton 
Date:   Fri Dec 12 07:06:07 2008 -0500

mount.cifs: allow mounts to ipv6 capable servers

The current name resolution scheme in mount.cifs is IPv4 only. Expand
it to be protocol-independent. Also take advantage of the fact that
getaddrinfo() returns a list of addresses and have mount.cifs try each
in turn until it hits one that's reachable and allows the socket to
connect.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 source/client/mount.cifs.c |  221 
 1 files changed, 120 insertions(+), 101 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 0bc61ae..9f4d1d3 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -80,6 +80,9 @@
 #define MOUNT_PASSWD_SIZE 64
 #define DOMAIN_SIZE 64
 
+/* currently maximum length of IPv6 address string */
+#define MAX_ADDRESS_LEN INET6_ADDRSTRLEN
+
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -189,12 +192,6 @@ static char * getusername(void) {
return username;
 }
 
-static char * parse_cifs_url(char * unc_name)
-{
-   printf("\nMounting cifs URL not implemented yet. Attempt to mount 
%s\n",unc_name);
-   return NULL;
-}
-
 static int open_cred_file(char * file_name)
 {
char * line_buf;
@@ -494,7 +491,7 @@ static int parse_options(char ** optionsp, int * 
filesys_flags)
} else if (strncmp(data, "ip", 2) == 0) {
if (!value || !*value) {
printf("target ip address argument missing");
-   } else if (strnlen(value, 35) < 35) {
+   } else if (strnlen(value, MAX_ADDRESS_LEN) <= 
MAX_ADDRESS_LEN) {
if(verboseflag)
printf("ip address %s override 
specified\n",value);
got_ip = 1;
@@ -882,23 +879,23 @@ static void replace_char(char *string, char from, char 
to, int maxlen)
 }
 
 /* Note that caller frees the returned buffer if necessary */
-static char * parse_server(char ** punc_name)
+static struct addrinfo *
+parse_server(char ** punc_name)
 {
char * unc_name = *punc_name;
int length = strnlen(unc_name, MAX_UNC_LEN);
char * share;
-   char * ipaddress_string = NULL;
-   struct hostent * host_entry = NULL;
-   struct in_addr server_ipaddr;
+   struct addrinfo *addrlist;
+   int rc;
 
if(length > (MAX_UNC_LEN - 1)) {
printf("mount error: UNC name too long");
return NULL;
}
-   if (strncasecmp("cifs://",unc_name,7) == 0)
-   return parse_cifs_url(unc_name+7);
-   if (strncasecmp("smb://",unc_name,6) == 0) {
-   return parse_cifs_url(unc_name+6);
+   if ((strncasecmp("cifs://", unc_name, 7) == 0) ||
+   (strncasecmp("smb://", unc_name, 6) == 0)) {
+   printf("\nMounting cifs URL not implemented yet. Attempt to 
mount %s\n", unc_name);
+   return NULL;
}
 
if(length < 3) {
@@ -939,7 +936,12 @@ continue_unc_parsing:
*share = 0;  /* temporarily terminate the 
string */
share += 1;
if(got_ip == 0) {
-   host_entry = gethostbyname(unc_name);
+   rc = getaddrinfo(unc_name, NULL, NULL, 
&addrlist);
+   if (rc != 0) {
+   printf("mount error: could not 
resolve address for %s: %s\n",
+   unc_name, 
gai_strerror(rc));
+   addrlist = NULL;
+   }
}
*(share - 1) = '/'; /* put delimiter back */
 
@@ -954,23 +956,9 @@ continue_unc_parsing:
printf("ip address specified 
explicitly\n");
return NULL;
}
-   if(host_entry == NULL) {
-   printf("mount error: cou

[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3260-g9af716f

2008-12-12 Thread Jeff Layton
The branch, v3-2-test has been updated
   via  9af716f5fb144a047f1fc9fe02f24bcc59a0bc97 (commit)
  from  fda3f00246c3ecb664d2bf387ecd0e28dec16e34 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 9af716f5fb144a047f1fc9fe02f24bcc59a0bc97
Author: Jeff Layton 
Date:   Fri Dec 12 07:08:30 2008 -0500

mount.cifs: allow mounts to ipv6 capable servers

The current name resolution scheme in mount.cifs is IPv4 only. Expand
it to be protocol-independent. Also take advantage of the fact that
getaddrinfo() returns a list of addresses and have mount.cifs try each
in turn until it hits one that's reachable and allows the socket to
connect.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 source/client/mount.cifs.c |  221 
 1 files changed, 120 insertions(+), 101 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 2e059e8..79a84e6 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -80,6 +80,9 @@
 #define MOUNT_PASSWD_SIZE 64
 #define DOMAIN_SIZE 64
 
+/* currently maximum length of IPv6 address string */
+#define MAX_ADDRESS_LEN INET6_ADDRSTRLEN
+
 const char *thisprogram;
 int verboseflag = 0;
 static int got_password = 0;
@@ -189,12 +192,6 @@ static char * getusername(void) {
return username;
 }
 
-static char * parse_cifs_url(char * unc_name)
-{
-   printf("\nMounting cifs URL not implemented yet. Attempt to mount 
%s\n",unc_name);
-   return NULL;
-}
-
 static int open_cred_file(char * file_name)
 {
char * line_buf;
@@ -493,7 +490,7 @@ static int parse_options(char ** optionsp, int * 
filesys_flags)
} else if (strncmp(data, "ip", 2) == 0) {
if (!value || !*value) {
printf("target ip address argument missing");
-   } else if (strnlen(value, 35) < 35) {
+   } else if (strnlen(value, MAX_ADDRESS_LEN) <= 
MAX_ADDRESS_LEN) {
if(verboseflag)
printf("ip address %s override 
specified\n",value);
got_ip = 1;
@@ -878,23 +875,23 @@ static void replace_char(char *string, char from, char 
to, int maxlen)
 }
 
 /* Note that caller frees the returned buffer if necessary */
-static char * parse_server(char ** punc_name)
+static struct addrinfo *
+parse_server(char ** punc_name)
 {
char * unc_name = *punc_name;
int length = strnlen(unc_name, MAX_UNC_LEN);
char * share;
-   char * ipaddress_string = NULL;
-   struct hostent * host_entry = NULL;
-   struct in_addr server_ipaddr;
+   struct addrinfo *addrlist;
+   int rc;
 
if(length > (MAX_UNC_LEN - 1)) {
printf("mount error: UNC name too long");
return NULL;
}
-   if (strncasecmp("cifs://",unc_name,7) == 0)
-   return parse_cifs_url(unc_name+7);
-   if (strncasecmp("smb://",unc_name,6) == 0) {
-   return parse_cifs_url(unc_name+6);
+   if ((strncasecmp("cifs://", unc_name, 7) == 0) ||
+   (strncasecmp("smb://", unc_name, 6) == 0)) {
+   printf("\nMounting cifs URL not implemented yet. Attempt to 
mount %s\n", unc_name);
+   return NULL;
}
 
if(length < 3) {
@@ -935,7 +932,12 @@ continue_unc_parsing:
*share = 0;  /* temporarily terminate the 
string */
share += 1;
if(got_ip == 0) {
-   host_entry = gethostbyname(unc_name);
+   rc = getaddrinfo(unc_name, NULL, NULL, 
&addrlist);
+   if (rc != 0) {
+   printf("mount error: could not 
resolve address for %s: %s\n",
+   unc_name, 
gai_strerror(rc));
+   addrlist = NULL;
+   }
}
*(share - 1) = '/'; /* put delimiter back */
 
@@ -950,23 +952,9 @@ continue_unc_parsing:
printf("ip address specified 
explicitly\n");
return NULL;
}
-   if(host_entry == NULL) {
-   printf("mount error: cou

[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-512-g16d2fdf

2009-02-05 Thread Jeff Layton
The branch, master has been updated
   via  16d2fdf5750dbb344b19df23fb741fc8e0b43d10 (commit)
  from  f023bf94f1cfb0523cbbd24b5a44c6ae6450f261 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 16d2fdf5750dbb344b19df23fb741fc8e0b43d10
Author: Shirish Pargaonkar 
Date:   Thu Feb 5 14:12:42 2009 -0500

umount.cifs: clean-up entries in /etc/mtab after unmount

This patch removes the remaining entry in /etc/mtab after a filesystem
is unmounted by canonicalizing the mountpoint supplied on the command
line.

Please refer to bug 4370 in samba bugzilla.

---

Summary of changes:
 source3/client/umount.cifs.c |   34 +-
 1 files changed, 33 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/umount.cifs.c b/source3/client/umount.cifs.c
index aff7cea..81925ed 100644
--- a/source3/client/umount.cifs.c
+++ b/source3/client/umount.cifs.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "mount.h"
 
 #define UNMOUNT_CIFS_VERSION_MAJOR "0"
@@ -231,6 +232,37 @@ static int remove_from_mtab(char * mountpoint)
return rc;
 }
 
+/* Make a canonical pathname from PATH.  Returns a freshly malloced string.
+   It is up the *caller* to ensure that the PATH is sensible.  i.e.
+   canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.''
+   is not a legal pathname for ``/dev/fd0''  Anything we cannot parse
+   we return unmodified.   */
+static char *
+canonicalize(char *path)
+{
+   char *canonical = malloc (PATH_MAX + 1);
+
+   if (!canonical) {
+   fprintf(stderr, "Error! Not enough memory!\n");
+   return NULL;
+   }
+
+   if (strlen(path) > PATH_MAX) {
+   fprintf(stderr, "Mount point string too long\n");
+   return NULL;
+   }
+
+   if (path == NULL)
+   return NULL;
+
+   if (realpath (path, canonical))
+   return canonical;
+
+   strncpy (canonical, path, PATH_MAX);
+   canonical[PATH_MAX] = '\0';
+   return canonical;
+}
+
 int main(int argc, char ** argv)
 {
int c;
@@ -304,7 +336,7 @@ int main(int argc, char ** argv)
argv += optind;
argc -= optind;
 
-   mountpoint = argv[0];
+   mountpoint = canonicalize(argv[0]);
 
if((argc < 1) || (argv[0] == NULL)) {
printf("\nMissing name of unmount directory\n");


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4908-g544faeb

2009-02-05 Thread Jeff Layton
The branch, v3-3-test has been updated
   via  544faebe894b2b0661d6c9fe68ee7c01945ee824 (commit)
  from  91c78b7d2bbb52015378f2a9752e783df33a6fff (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -
commit 544faebe894b2b0661d6c9fe68ee7c01945ee824
Author: Shirish Pargaonkar 
Date:   Thu Feb 5 14:16:53 2009 -0500

umount.cifs: clean-up entries in /etc/mtab after unmount

This patch removes the remaining entry in /etc/mtab after a filesystem
is unmounted by canonicalizing the mountpoint supplied on the command
line.

Please refer to bug 4370 in samba bugzilla.

---

Summary of changes:
 source/client/umount.cifs.c |   34 +-
 1 files changed, 33 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/umount.cifs.c b/source/client/umount.cifs.c
index aff7cea..81925ed 100644
--- a/source/client/umount.cifs.c
+++ b/source/client/umount.cifs.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "mount.h"
 
 #define UNMOUNT_CIFS_VERSION_MAJOR "0"
@@ -231,6 +232,37 @@ static int remove_from_mtab(char * mountpoint)
return rc;
 }
 
+/* Make a canonical pathname from PATH.  Returns a freshly malloced string.
+   It is up the *caller* to ensure that the PATH is sensible.  i.e.
+   canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.''
+   is not a legal pathname for ``/dev/fd0''  Anything we cannot parse
+   we return unmodified.   */
+static char *
+canonicalize(char *path)
+{
+   char *canonical = malloc (PATH_MAX + 1);
+
+   if (!canonical) {
+   fprintf(stderr, "Error! Not enough memory!\n");
+   return NULL;
+   }
+
+   if (strlen(path) > PATH_MAX) {
+   fprintf(stderr, "Mount point string too long\n");
+   return NULL;
+   }
+
+   if (path == NULL)
+   return NULL;
+
+   if (realpath (path, canonical))
+   return canonical;
+
+   strncpy (canonical, path, PATH_MAX);
+   canonical[PATH_MAX] = '\0';
+   return canonical;
+}
+
 int main(int argc, char ** argv)
 {
int c;
@@ -304,7 +336,7 @@ int main(int argc, char ** argv)
argv += optind;
argc -= optind;
 
-   mountpoint = argv[0];
+   mountpoint = canonicalize(argv[0]);
 
if((argc < 1) || (argv[0] == NULL)) {
printf("\nMissing name of unmount directory\n");


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3428-g27f34cb

2009-02-05 Thread Jeff Layton
The branch, v3-2-test has been updated
   via  27f34cb57c4e4299cb43c14e22c5b15053c898ea (commit)
  from  52e48c12cf2a56d31a2404ab142d6678b430a85a (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 27f34cb57c4e4299cb43c14e22c5b15053c898ea
Author: Shirish Pargaonkar 
Date:   Thu Feb 5 14:17:48 2009 -0500

umount.cifs: clean-up entries in /etc/mtab after unmount

This patch removes the remaining entry in /etc/mtab after a filesystem
is unmounted by canonicalizing the mountpoint supplied on the command
line.

Please refer to bug 4370 in samba bugzilla.

---

Summary of changes:
 source/client/umount.cifs.c |   34 +-
 1 files changed, 33 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/umount.cifs.c b/source/client/umount.cifs.c
index aff7cea..81925ed 100644
--- a/source/client/umount.cifs.c
+++ b/source/client/umount.cifs.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "mount.h"
 
 #define UNMOUNT_CIFS_VERSION_MAJOR "0"
@@ -231,6 +232,37 @@ static int remove_from_mtab(char * mountpoint)
return rc;
 }
 
+/* Make a canonical pathname from PATH.  Returns a freshly malloced string.
+   It is up the *caller* to ensure that the PATH is sensible.  i.e.
+   canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.''
+   is not a legal pathname for ``/dev/fd0''  Anything we cannot parse
+   we return unmodified.   */
+static char *
+canonicalize(char *path)
+{
+   char *canonical = malloc (PATH_MAX + 1);
+
+   if (!canonical) {
+   fprintf(stderr, "Error! Not enough memory!\n");
+   return NULL;
+   }
+
+   if (strlen(path) > PATH_MAX) {
+   fprintf(stderr, "Mount point string too long\n");
+   return NULL;
+   }
+
+   if (path == NULL)
+   return NULL;
+
+   if (realpath (path, canonical))
+   return canonical;
+
+   strncpy (canonical, path, PATH_MAX);
+   canonical[PATH_MAX] = '\0';
+   return canonical;
+}
+
 int main(int argc, char ** argv)
 {
int c;
@@ -304,7 +336,7 @@ int main(int argc, char ** argv)
argv += optind;
argc -= optind;
 
-   mountpoint = argv[0];
+   mountpoint = canonicalize(argv[0]);
 
if((argc < 1) || (argv[0] == NULL)) {
printf("\nMissing name of unmount directory\n");


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-32-145-gdf341bd

2009-02-05 Thread Jeff Layton
The branch, v3-0-test has been updated
   via  df341bd2b83cc67e31d5b91ae39b4f4f7619ffd0 (commit)
  from  7a1408f89f1addff993d1e2dfb7462d12d0a2f48 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -
commit df341bd2b83cc67e31d5b91ae39b4f4f7619ffd0
Author: Shirish Pargaonkar 
Date:   Thu Feb 5 14:18:36 2009 -0500

umount.cifs: clean-up entries in /etc/mtab after unmount

This patch removes the remaining entry in /etc/mtab after a filesystem
is unmounted by canonicalizing the mountpoint supplied on the command
line.

Please refer to bug 4370 in samba bugzilla.

---

Summary of changes:
 source/client/umount.cifs.c |   34 +-
 1 files changed, 33 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/umount.cifs.c b/source/client/umount.cifs.c
index 8f2f377..6bed410 100644
--- a/source/client/umount.cifs.c
+++ b/source/client/umount.cifs.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "mount.h"
 
 #define UNMOUNT_CIFS_VERSION_MAJOR "0"
@@ -232,6 +233,37 @@ static int remove_from_mtab(char * mountpoint)
return rc;
 }
 
+/* Make a canonical pathname from PATH.  Returns a freshly malloced string.
+   It is up the *caller* to ensure that the PATH is sensible.  i.e.
+   canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.''
+   is not a legal pathname for ``/dev/fd0''  Anything we cannot parse
+   we return unmodified.   */
+static char *
+canonicalize(char *path)
+{
+   char *canonical = malloc (PATH_MAX + 1);
+
+   if (!canonical) {
+   fprintf(stderr, "Error! Not enough memory!\n");
+   return NULL;
+   }
+
+   if (strlen(path) > PATH_MAX) {
+   fprintf(stderr, "Mount point string too long\n");
+   return NULL;
+   }
+
+   if (path == NULL)
+   return NULL;
+
+   if (realpath (path, canonical))
+   return canonical;
+
+   strncpy (canonical, path, PATH_MAX);
+   canonical[PATH_MAX] = '\0';
+   return canonical;
+}
+
 int main(int argc, char ** argv)
 {
int c;
@@ -305,7 +337,7 @@ int main(int argc, char ** argv)
argv += optind;
argc -= optind;
 
-   mountpoint = argv[0];
+   mountpoint = canonicalize(argv[0]);
 
if((argc < 1) || (argv[0] == NULL)) {
printf("\nMissing name of unmount directory\n");


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-536-gea8bd81b

2009-02-06 Thread Jeff Layton
The branch, master has been updated
   via  ea8bd81b6eaf2d2ca005d30c1580e7a45d3b3c5d (commit)
  from  2170a810ed16043c6292eb3e39437a8cf96a8be6 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit ea8bd81b6eaf2d2ca005d30c1580e7a45d3b3c5d
Author: Shirish Pargaonkar 
Date:   Fri Feb 6 08:13:38 2009 -0500

mount.cifs: add fakemount (-f) and nomtab (-n) flags to mount.cifs

...so that these options work correctly when passed in by mount(8).

---

Summary of changes:
 source3/client/mount.cifs.c |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index 9f4d1d3..df5be84 100644
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -85,6 +85,7 @@
 
 const char *thisprogram;
 int verboseflag = 0;
+int fakemnt = 0;
 static int got_password = 0;
 static int got_user = 0;
 static int got_domain = 0;
@@ -1103,8 +1104,8 @@ int main(int argc, char ** argv)
mount_cifs_usage ();
exit(EX_USAGE);
case 'n':
-   ++nomtab;
-   break;
+   ++nomtab;
+   break;
case 'b':
 #ifdef MS_BIND
flags |= MS_BIND;
@@ -1209,6 +1210,9 @@ int main(int argc, char ** argv)
break;
case 't':
break;
+   case 'f':
+   ++fakemnt;
+   break;
default:
printf("unknown mount option %c\n",c);
mount_cifs_usage();
@@ -1410,7 +1414,7 @@ mount_retry:
}
}
 
-   if (mount(dev_name, mountpoint, "cifs", flags, options)) {
+   if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
switch (errno) {
case ECONNREFUSED:
case EHOSTUNREACH:
@@ -1440,6 +1444,8 @@ mount_retry:
goto mount_exit;
}
 
+   if (nomtab)
+   goto mount_exit;
atexit(unlock_mtab);
rc = lock_mtab();
if (rc) {


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-32-148-ga894bd4

2009-02-06 Thread Jeff Layton
The branch, v3-0-test has been updated
   via  a894bd4504f070233dd2785a62483090581f5bf3 (commit)
  from  45699a287d27cce24e883384a72441d310c8ee28 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -
commit a894bd4504f070233dd2785a62483090581f5bf3
Author: Shirish Pargaonkar 
Date:   Fri Feb 6 08:23:52 2009 -0500

mount.cifs: add fakemount (-f) and nomtab (-n) flags to mount.cifs

...so that these options work correctly when passed in by mount(8).

---

Summary of changes:
 source/client/mount.cifs.c |   15 ++-
 1 files changed, 10 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 1ac1410..939db45 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -71,6 +71,7 @@
 
 const char *thisprogram;
 int verboseflag = 0;
+int fakemnt = 0;
 static int got_password = 0;
 static int got_user = 0;
 static int got_domain = 0;
@@ -1018,7 +1019,7 @@ int main(int argc, char ** argv)
char * resolved_path = NULL;
char * temp;
char * dev_name;
-   int rc;
+   int rc = 0;
int rsize = 0;
int wsize = 0;
int nomtab = 0;
@@ -1087,8 +1088,8 @@ int main(int argc, char ** argv)
mount_cifs_usage ();
exit(EX_USAGE);
case 'n':
-   ++nomtab;
-   break;
+   ++nomtab;
+   break;
case 'b':
 #ifdef MS_BIND
flags |= MS_BIND;
@@ -1196,6 +1197,9 @@ int main(int argc, char ** argv)
break;
case 't':
break;
+   case 'f':
+   ++fakemnt;
+   break;
default:
printf("unknown mount option %c\n",c);
mount_cifs_usage();
@@ -1376,8 +1380,7 @@ mount_retry:
/* convert all '\\' to '/' in share portion so that /proc/mounts looks 
pretty */
replace_char(dev_name, '\\', '/', strlen(share_name));
 
-   if(mount(dev_name, mountpoint, "cifs", flags, options)) {
-   /* remember to kill daemon on error */
+   if(!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
switch (errno) {
case 0:
printf("mount failed but no error number set\n");
@@ -1401,6 +1404,8 @@ mount_retry:
printf("Refer to the mount.cifs(8) manual page (e.g.man 
mount.cifs)\n");
rc = EX_FAIL;
} else {
+   if (nomtab)
+   goto mount_exit;
atexit(unlock_mtab);
rc = lock_mtab();
if (rc) {


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha6-537-gd895ca5

2009-02-06 Thread Jeff Layton
The branch, master has been updated
   via  d895ca505f7f9c4edf476a0c966e93917e35575c (commit)
  from  ea8bd81b6eaf2d2ca005d30c1580e7a45d3b3c5d (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit d895ca505f7f9c4edf476a0c966e93917e35575c
Author: Jeff Layton 
Date:   Fri Feb 6 08:29:58 2009 -0500

mount.cifs: initialize rc to 0 in main

The value of rc in main() isn't initialized in the declaration. This
wasn't a problem before, but Shirish's fakemount patch can make it so
that we return the uninitialized variable if the -n flag is used.

Fix this by initializing rc to 0.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 source3/client/mount.cifs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/client/mount.cifs.c b/source3/client/mount.cifs.c
index df5be84..a736609 100644
--- a/source3/client/mount.cifs.c
+++ b/source3/client/mount.cifs.c
@@ -1031,7 +1031,7 @@ int main(int argc, char ** argv)
char * resolved_path = NULL;
char * temp;
char * dev_name;
-   int rc;
+   int rc = 0;
int rsize = 0;
int wsize = 0;
int nomtab = 0;


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4916-g45d75ec

2009-02-06 Thread Jeff Layton
The branch, v3-3-test has been updated
   via  45d75ece3e35b5180e82dc0488b13fbd2a93c41e (commit)
  from  5cd79db1326d70c592e86491d36567a2eb4e1717 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -
commit 45d75ece3e35b5180e82dc0488b13fbd2a93c41e
Author: Jeff Layton 
Date:   Fri Feb 6 08:31:45 2009 -0500

mount.cifs: initialize rc to 0 in main

The value of rc in main() isn't initialized in the declaration. This
wasn't a problem before, but Shirish's fakemount patch can make it so
that we return the uninitialized variable if the -n flag is used.

Fix this by initializing rc to 0.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 source/client/mount.cifs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index df5be84..a736609 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -1031,7 +1031,7 @@ int main(int argc, char ** argv)
char * resolved_path = NULL;
char * temp;
char * dev_name;
-   int rc;
+   int rc = 0;
int rsize = 0;
int wsize = 0;
int nomtab = 0;


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3434-gc86c221

2009-02-06 Thread Jeff Layton
The branch, v3-2-test has been updated
   via  c86c2219b23fb2e5ce652dae18b0299d76dcb524 (commit)
  from  035fa67801d55f05afbac94592a7700764624ee4 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit c86c2219b23fb2e5ce652dae18b0299d76dcb524
Author: Jeff Layton 
Date:   Fri Feb 6 08:32:40 2009 -0500

mount.cifs: initialize rc to 0 in main

The value of rc in main() isn't initialized in the declaration. This
wasn't a problem before, but Shirish's fakemount patch can make it so
that we return the uninitialized variable if the -n flag is used.

Fix this by initializing rc to 0.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 source/client/mount.cifs.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 021baf4..e7397da 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -1027,7 +1027,7 @@ int main(int argc, char ** argv)
char * resolved_path = NULL;
char * temp;
char * dev_name;
-   int rc;
+   int rc = 0;
int rsize = 0;
int wsize = 0;
int nomtab = 0;


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3433-g035fa67

2009-02-06 Thread Jeff Layton
The branch, v3-2-test has been updated
   via  035fa67801d55f05afbac94592a7700764624ee4 (commit)
  from  fe456e4bf8db272d1d6e99b4c1714894af17190b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -
commit 035fa67801d55f05afbac94592a7700764624ee4
Author: Shirish Pargaonkar 
Date:   Fri Feb 6 08:16:11 2009 -0500

mount.cifs: add fakemount (-f) and nomtab (-n) flags to mount.cifs

...so that these options work correctly when passed in by mount(8).

---

Summary of changes:
 source/client/mount.cifs.c |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 79a84e6..021baf4 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -85,6 +85,7 @@
 
 const char *thisprogram;
 int verboseflag = 0;
+int fakemnt = 0;
 static int got_password = 0;
 static int got_user = 0;
 static int got_domain = 0;
@@ -1099,8 +1100,8 @@ int main(int argc, char ** argv)
mount_cifs_usage ();
exit(EX_USAGE);
case 'n':
-   ++nomtab;
-   break;
+   ++nomtab;
+   break;
case 'b':
 #ifdef MS_BIND
flags |= MS_BIND;
@@ -1205,6 +1206,9 @@ int main(int argc, char ** argv)
break;
case 't':
break;
+   case 'f':
+   ++fakemnt;
+   break;
default:
printf("unknown mount option %c\n",c);
mount_cifs_usage();
@@ -1400,7 +1404,7 @@ mount_retry:
}
}
 
-   if (mount(dev_name, mountpoint, "cifs", flags, options)) {
+   if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
switch (errno) {
case ECONNREFUSED:
case EHOSTUNREACH:
@@ -1430,6 +1434,8 @@ mount_retry:
goto mount_exit;
}
 
+   if (nomtab)
+   goto mount_exit;
atexit(unlock_mtab);
rc = lock_mtab();
if (rc) {


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4915-g5cd79db1

2009-02-06 Thread Jeff Layton
The branch, v3-3-test has been updated
   via  5cd79db1326d70c592e86491d36567a2eb4e1717 (commit)
  from  e513360db3f2cc6ff1865ec08fc243dd6346e18e (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -
commit 5cd79db1326d70c592e86491d36567a2eb4e1717
Author: Shirish Pargaonkar 
Date:   Fri Feb 6 08:15:35 2009 -0500

mount.cifs: add fakemount (-f) and nomtab (-n) flags to mount.cifs

...so that these options work correctly when passed in by mount(8).

---

Summary of changes:
 source/client/mount.cifs.c |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index 9f4d1d3..df5be84 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -85,6 +85,7 @@
 
 const char *thisprogram;
 int verboseflag = 0;
+int fakemnt = 0;
 static int got_password = 0;
 static int got_user = 0;
 static int got_domain = 0;
@@ -1103,8 +1104,8 @@ int main(int argc, char ** argv)
mount_cifs_usage ();
exit(EX_USAGE);
case 'n':
-   ++nomtab;
-   break;
+   ++nomtab;
+   break;
case 'b':
 #ifdef MS_BIND
flags |= MS_BIND;
@@ -1209,6 +1210,9 @@ int main(int argc, char ** argv)
break;
case 't':
break;
+   case 'f':
+   ++fakemnt;
+   break;
default:
printf("unknown mount option %c\n",c);
mount_cifs_usage();
@@ -1410,7 +1414,7 @@ mount_retry:
}
}
 
-   if (mount(dev_name, mountpoint, "cifs", flags, options)) {
+   if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
switch (errno) {
case ECONNREFUSED:
case EHOSTUNREACH:
@@ -1440,6 +1444,8 @@ mount_retry:
goto mount_exit;
}
 
+   if (nomtab)
+   goto mount_exit;
atexit(unlock_mtab);
rc = lock_mtab();
if (rc) {


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-2102-gcc7b622

2009-06-06 Thread Jeff Layton
The branch, master has been updated
   via  cc7b62269e4a90859dd93b8d6896390857ba17d7 (commit)
  from  93e797064753e815a3fe5e32fdea167b395b58d3 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit cc7b62269e4a90859dd93b8d6896390857ba17d7
Author: Jeff Layton 
Date:   Sat Jun 6 19:46:24 2009 -0400

mount.cifs: properly check for mount being in fstab when running setuid 
root (try#3)

This is the third attempt to clean up the checks when a setuid
mount.cifs is run by an unprivileged user. The main difference in this
patch from the last one is that it fixes a bug where the mount might
have failed if unnecessarily if CIFS_LEGACY_SETUID_CHECK was set.

When mount.cifs is installed setuid root and run as an unprivileged
user, it does some checks to limit how the mount is used. It checks that
the mountpoint is owned by the user doing the mount.

These checks however do not match those that /bin/mount does when it is
called by an unprivileged user. When /bin/mount is called by an
unprivileged user to do a mount, it checks that the mount in question is
in /etc/fstab, that it has the "user" option set, etc.

This means that it's currently not possible to set up user mounts the
standard way (by the admin, in /etc/fstab) and simultaneously protect
from an unprivileged user calling mount.cifs directly to mount a share
on any directory that that user owns.

Fix this by making the checks in mount.cifs match those of /bin/mount
itself. This is a necessary step to make mount.cifs safe to be installed
as a setuid binary, but not sufficient. For that, we'd need to give
mount.cifs a proper security audit.

Since some users may be depending on the legacy behavior, this patch
also adds the ability to build mount.cifs with the older behavior.

    Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/mount.cifs.c |  202 +--
 1 files changed, 162 insertions(+), 40 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/mount.cifs.c b/client/mount.cifs.c
index 1b94486..f53bcf1 100644
--- a/client/mount.cifs.c
+++ b/client/mount.cifs.c
@@ -39,10 +39,11 @@
 #include 
 #include 
 #include 
+#include 
 #include "mount.h"
 
 #define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "12"
+#define MOUNT_CIFS_VERSION_MINOR "13"
 
 #ifndef MOUNT_CIFS_VENDOR_SUFFIX
  #ifdef _SAMBA_BUILD_
@@ -69,6 +70,10 @@
 #define MS_BIND 4096
 #endif
 
+/* private flags - clear these before passing to kernel */
+#define MS_USERS   0x4000
+#define MS_USER0x8000
+
 #define MAX_UNC_LEN 1024
 
 #define CONST_DISCARD(type, ptr)  ((type) ((void *) (ptr)))
@@ -83,6 +88,27 @@
 /* currently maximum length of IPv6 address string */
 #define MAX_ADDRESS_LEN INET6_ADDRSTRLEN
 
+/*
+ * By default, mount.cifs follows the conventions set forth by /bin/mount
+ * for user mounts. That is, it requires that the mount be listed in
+ * /etc/fstab with the "user" option when run as an unprivileged user and
+ * mount.cifs is setuid root.
+ *
+ * Older versions of mount.cifs however were "looser" in this regard. When
+ * made setuid root, a user could run mount.cifs directly and mount any share
+ * on a directory owned by that user.
+ *
+ * The legacy behavior is now disabled by default. To reenable it, set the
+ * following #define to true.
+ */
+#define CIFS_LEGACY_SETUID_CHECK 0
+
+/*
+ * When an unprivileged user runs a setuid mount.cifs, we set certain mount
+ * flags by default. These defaults can be changed here.
+ */
+#define CIFS_SETUID_FLAGS (MS_NOSUID|MS_NODEV)
+
 const char *thisprogram;
 int verboseflag = 0;
 int fakemnt = 0;
@@ -142,6 +168,99 @@ static size_t strlcat(char *d, const char *s, size_t 
bufsize)
 }
 #endif
 
+/*
+ * If an unprivileged user is doing the mounting then we need to ensure
+ * that the entry is in /etc/fstab.
+ */
+static int
+check_mountpoint(const char *progname, char *mountpoint)
+{
+   int err;
+   struct stat statbuf;
+
+   /* does mountpoint exist and is it a directory? */
+   err = stat(mountpoint, &statbuf);
+   if (err) {
+   fprintf(stderr, "%s: failed to stat %s: %s\n", progname,
+   mountpoint, strerror(errno));
+   return EX_USAGE;
+   }
+
+   if (!S_ISDIR(statbuf.st_mode)) {
+   fprintf(stderr, "%s: %s is not a directory!", progname,
+   mountpoint);
+   return EX_USAGE;
+   }
+
+#if CIFS_LEGACY_SETUID_CHECK
+   /* do extra checks on mountpoint for legacy setuid behavior

[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-2111-g27fcab9

2009-06-07 Thread Jeff Layton
The branch, master has been updated
   via  27fcab98e7095ea48d35c421f221cb8ac33f6ad2 (commit)
  from  14a2974092bec50d37feaa33e0cdd6fd336f492c (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 27fcab98e7095ea48d35c421f221cb8ac33f6ad2
Author: Jeff Layton 
Date:   Sun Jun 7 08:38:25 2009 -0400

mount.cifs: update the mount.cifs manpage

Add a new section entitled FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS
that attempts to cover information about this topic. Change the uid=
and gid= options to refer to that section. Add new varlistentries for
forceuid, forcegid and dynperm.

Also update the information about how the program behaves when installed
as a setuid binary.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 docs-xml/manpages-3/mount.cifs.8.xml |  145 ++
 1 files changed, 95 insertions(+), 50 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/mount.cifs.8.xml 
b/docs-xml/manpages-3/mount.cifs.8.xml
index d0affea..a748b90 100644
--- a/docs-xml/manpages-3/mount.cifs.8.xml
+++ b/docs-xml/manpages-3/mount.cifs.8.xml
@@ -47,9 +47,6 @@ by the popular Open Source server Samba.
specified as service (using //server/share syntax,
where "server" is the server name or IP address and "share" is the name
of the share) to the local directory mount-point.
-   It is possible to set the mode for mount.cifs to setuid root to allow
-   non-root users to mount shares to directories for which they
-   have write permission.

 

@@ -128,52 +125,53 @@ credentials file properly.
 

uid=arg
-
-   sets the uid that will own all files on
-   the mounted filesystem.
-   It may be specified as either a username or a numeric uid.
-   For mounts to servers which do support the CIFS Unix extensions, 
-such as a properly configured Samba server, the server provides
-the uid, gid and mode so this parameter should not be
-specified unless the server and client uid and gid
-numbering differ.  If the server and client are in the
-same domain (e.g. running winbind or nss_ldap) and
-the server supports the Unix Extensions then the uid
-and gid can be retrieved from the server (and uid
-and gid would not have to be specified on the mount.
-For servers which do not support the CIFS Unix
-extensions, the default uid (and gid) returned on lookup 
-of existing files will be the uid (gid) of the person
-who executed the mount (root, except when mount.cifs
-is configured setuid for user mounts) unless the "uid="
-(gid) mount option is specified.  For the uid (gid) of newly
-created files and directories, ie files created since
-the last mount of the server share, the expected uid
-(gid) is cached as long as the inode remains in
-memory on the client.   Also note that permission
-checks (authorization checks) on accesses to a file occur
-at the server, but there are cases in which an administrator
-may want to restrict at the client as well.  For those
-servers which do not report a uid/gid owner
-(such as Windows), permissions can also be checked at the
-client, and a crude form of client side permission checking
-can be enabled by specifying file_mode and dir_mode on
-the client.  Note that the mount.cifs helper must be
-at version 1.10 or higher to support specifying the uid
-(or gid) in non-numeric form.
-   
-   
-
-   
-   gid=arg
-
-   sets the gid that will own all files on
-the mounted filesystem.  It may be specified as either a groupname or a 
numeric 
-gid. For other considerations see the description of uid above. 
-   
-   
-
-   
+   
+
+   sets the uid that will own all files or directories on the
+mounted filesystem when the server does not provide ownership
+information. It may be specified as either a username or a numeric uid.
+When not specified, the default is uid 0.  The mount.cifs helper must be
+at version 1.10 or higher to support specifying the uid in non-numeric
+form. See the section on FILE AND DIRECTORY OWNERSHIP AND PERMISSIONS below 
for more
+information.  
+
+
+
+
+
+   forceuid
+   
+   instructs the client to ignore any uid provided by
+the server for files and directories and

[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-2215-gddad58f

2009-06-10 Thread Jeff Layton
The branch, master has been updated
   via  ddad58fc41b5ecd1056e444d28020ac1c036a71e (commit)
  from  ad0d8032068fc9b920e205d3f5f923174101d777 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit ddad58fc41b5ecd1056e444d28020ac1c036a71e
Author: Jeff Layton 
Date:   Wed Jun 10 09:00:21 2009 -0400

mount.cifs: explicitly handle non AF_INET/AF_INET6 addresses

If we get a non-AF_INET(6) address, then just skip it and try the next
one in the list.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/mount.cifs.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/mount.cifs.c b/client/mount.cifs.c
index f53bcf1..97144a0 100644
--- a/client/mount.cifs.c
+++ b/client/mount.cifs.c
@@ -1548,6 +1548,8 @@ mount_retry:
ipaddr = inet_ntop(AF_INET, &addr4->sin_addr, 
optionstail,
   options_size - current_len);
break;
+   default:
+   ipaddr = NULL;
}
 
/* if the address looks bogus, try the next one */


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-62-g2032a19

2009-06-25 Thread Jeff Layton
The branch, master has been updated
   via  2032a1914d72e4de89280e179c782566cafc163a (commit)
  from  313a2bfa527796f6512b2589a8b567c86436cf12 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 2032a1914d72e4de89280e179c782566cafc163a
Author: Jeff Layton 
Date:   Thu Jun 25 07:27:25 2009 -0400

mount.cifs: add support for sending IPv6 scope ID to kernel

When getaddrinfo returns an IPv6 address with a non-zero scope_id, send
that to the kernel appended to the address with a '%' delimiter. This
allows people to mount servers via their link-local IPv6 addresses
(given a kernel that understands this address format, of course).

Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/mount.cifs.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/mount.cifs.c b/client/mount.cifs.c
index 97144a0..db05665 100644
--- a/client/mount.cifs.c
+++ b/client/mount.cifs.c
@@ -1562,6 +1562,14 @@ mount_retry:
}
}
 
+   if (addr->ai_addr->sa_family == AF_INET6 && addr6->sin6_scope_id) {
+   strlcat(options, "%", options_size);
+   current_len = strnlen(options, options_size);
+   optionstail = options + current_len;
+   snprintf(optionstail, options_size - current_len, "%u",
+addr6->sin6_scope_id);
+   }
+
if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
switch (errno) {
case ECONNREFUSED:


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-108-g595d07d

2009-06-29 Thread Jeff Layton
The branch, master has been updated
   via  595d07d0ab494e3749c71caf86887ad1cebda229 (commit)
  from  6e92505080fd6764461563e4fdf1172be1ba2963 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 595d07d0ab494e3749c71caf86887ad1cebda229
Author: Jeff Layton 
Date:   Mon Jun 29 06:16:38 2009 -0400

mount.cifs: don't pass text ro/rw options to kernel

/bin/mount strips off the ro/rw options after setting the MS_RDONLY
flag appropriately. Make mount.cifs do the same thing.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/mount.cifs.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/mount.cifs.c b/client/mount.cifs.c
index db05665..4387f59 100644
--- a/client/mount.cifs.c
+++ b/client/mount.cifs.c
@@ -771,8 +771,10 @@ static int parse_options(char ** optionsp, unsigned long * 
filesys_flags)
got_password = 1;
} else if (strncmp(data, "ro", 2) == 0) {
*filesys_flags |= MS_RDONLY;
+   goto nocopy;
} else if (strncmp(data, "rw", 2) == 0) {
*filesys_flags &= ~MS_RDONLY;
+   goto nocopy;
 } else if (strncmp(data, "remount", 7) == 0) {
 *filesys_flags |= MS_REMOUNT;
} /* else if (strnicmp(data, "port", 4) == 0) {


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-133-gf725014

2009-06-30 Thread Jeff Layton
The branch, master has been updated
   via  f7250144ed06b00fc1fbf1854d38483c427fad87 (commit)
  from  91a8cb851e1919a337310e2c699d8fcf76a55060 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit f7250144ed06b00fc1fbf1854d38483c427fad87
Author: Jeff Layton 
Date:   Tue Jun 30 15:03:13 2009 -0400

umount.cifs: don't build it by default

Now that the sanity checks for mount.cifs default to matching the
behavior of /bin/mount, then there is virtually no need for umount.cifs.
The only exception is when someone enables the loose setuid behavior in
mount.cifs.

If an unprivileged user mounts a share that isn't in /etc/fstab, then
/bin/mount won't allow that user to unmount it. In that situation,
umount.cifs will be necessary to allow unmounting the share.

Signed-off-by: Jeff Layton 
Acked-by: Steve French 

---

Summary of changes:
 source3/Makefile.in  |   13 ++---
 source3/configure.in |   43 +--
 2 files changed, 47 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index 62d4fbe..ab93a6b 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -204,7 +204,7 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
 
 SBIN_PROGS = bin/s...@exeext@ bin/n...@exeext@ @SWAT_SBIN_TARGETS@ 
@EXTRA_SBIN_PROGS@
 
-ROOT_SBIN_PROGS = @CIFSMOUNT_PROGS@
+ROOT_SBIN_PROGS = @CIFSMOUNT_PROGS@ @CIFSUMOUNT_PROGS@
 
 BIN_PROGS1 = bin/smbcli...@exeext@ bin/n...@exeext@ bin/smbsp...@exeext@ \
bin/testp...@exeext@ bin/smbsta...@exeext@ bin/smb...@exeext@
@@ -2904,7 +2904,7 @@ bin/dbwrap_t...@exeext@: $(DBWRAP_TOOL_OBJ) 
@LIBTALLOC_TARGET@ @LIBTDB_TARGET@
 install-dbwrap_tool:: bin/dbwrap_t...@exeext@
@$(SHELL) script/installbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) 
$(BINDIR) $<
 
-install:: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSUPCALL@ 
installman \
+install:: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSUMOUNT@ 
@INSTALL_CIFSUPCALL@ installman \
installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ 
\
@INSTALL_PAM_MODULES@ installlibs installmo
 
@@ -2934,6 +2934,10 @@ installcifsmount:: @CIFSMOUNT_PROGS@
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(ROOTSBINDIR)
@$(SHELL) script/installbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) 
$(ROOTSBINDIR) @CIFSMOUNT_PROGS@
 
+installcifsumount:: @CIFSUMOUNT_PROGS@
+   @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(ROOTSBINDIR)
+   @$(SHELL) script/installbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) 
$(ROOTSBINDIR) @CIFSUMOUNT_PROGS@
+
 installcifsupcall:: @CIFSUPCALL_PROGS@
@$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS_BIN) 
$(DESTDIR) $(SBINDIR)
@$(SHELL) script/installbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) $(prefix) 
$(SBINDIR) @CIFSUPCALL_PROGS@
@@ -3013,7 +3017,7 @@ showlayout::
@echo "  codepagedir: $(CODEPAGEDIR)"
 
 
-uninstall:: uninstallmo uninstallman uninstallservers uninstallbin 
@UNINSTALL_CIFSMOUNT@ @UNINSTALL_CIFSUPCALL@ uninstallscripts uninstalldat 
uninstallswat uninstallmodules uninstalllibs @UNINSTALL_PAM_MODULES@
+uninstall:: uninstallmo uninstallman uninstallservers uninstallbin 
@UNINSTALL_CIFSMOUNT@ @UNINSTALL_CIFSUMOUNT@ @UNINSTALL_CIFSUPCALL@ 
uninstallscripts uninstalldat uninstallswat uninstallmodules uninstalllibs 
@UNINSTALL_PAM_MODULES@
 
 uninstallmo::
@$(SHELL) $(srcdir)/script/uninstallmo.sh $(DESTDIR) $(LOCALEDIR) 
$(srcdir)
@@ -3030,6 +3034,9 @@ uninstallbin::
 uninstallcifsmount::
@$(SHELL) script/uninstallbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) 
$(prefix) $(ROOTSBINDIR) @CIFSMOUNT_PROGS@
 
+uninstallcifsumount::
+   @$(SHELL) script/uninstallbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) 
$(prefix) $(ROOTSBINDIR) @CIFSUMOUNT_PROGS@
+
 uninstallcifsupcall::
@$(SHELL) script/uninstallbin.sh $(INSTALLPERMS_BIN) $(DESTDIR) 
$(prefix) $(ROOTSBINDIR) @CIFSUPCALL_PROGS@
 
diff --git a/source3/configure.in b/source3/configure.in
index 97d1a8b..0274336 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -96,6 +96,9 @@ AC_SUBST(EXTRA_BIN_PROGS)
 AC_SUBST(CIFSMOUNT_PROGS)
 AC_SUBST(INSTALL_CIFSMOUNT)
 AC_SUBST(UNINSTALL_CIFSMOUNT)
+AC_SUBST(CIFSUMOUNT_PROGS)
+AC_SUBST(INSTALL_CIFSUMOUNT)
+AC_SUBST(UNINSTALL_CIFSUMOUNT)
 AC_SUBST(CIFSUPCALL_PROGS)
 AC_SUBST(INSTALL_CIFSUPCALL)
 AC_SUBST(UNINSTALL_CIFSUPCALL)
@@ -3985,9 +3988,9 @@ AC_ARG_WITH(automount,
 CIFSMOUNT_PROGS=""
 INSTALL_CIFSMOUNT=""
 UNINSTALL_CIFSMOUNT=""
-AC_MSG_CHECKING(whether to build mount.cifs and umount.cifs)
+AC_MSG_CHECKING(whether t

[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-242-g91e020f

2009-07-06 Thread Jeff Layton
The branch, master has been updated
   via  91e020fca1b1428d994e742e97c5c73d4bf88458 (commit)
  from  5e7da42f6ea768a1e2eeeb15b8b2c41cdfcac94f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 91e020fca1b1428d994e742e97c5c73d4bf88458
Author: Suresh Jayaraman 
Date:   Mon Jul 6 06:31:30 2009 -0400

doc: clarify that mount.cifs never uses smb.conf

For some users who are used to smbclient, it is not clear that
mount.cifs never uses smb.conf for configuring client specific
parameters. So, let's add this information to mount.cifs man page.

Signed-off-by: Suresh Jayaraman 

---

Summary of changes:
 docs-xml/manpages-3/mount.cifs.8.xml |8 
 1 files changed, 8 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/mount.cifs.8.xml 
b/docs-xml/manpages-3/mount.cifs.8.xml
index a748b90..6461d82 100644
--- a/docs-xml/manpages-3/mount.cifs.8.xml
+++ b/docs-xml/manpages-3/mount.cifs.8.xml
@@ -589,6 +589,14 @@ read and used as the password.
NOTES

This command may be used only by root, unless installed setuid, 
in which case the noeexec and nosuid mount flags are enabled. When installed as 
a setuid program, the program follows the conventions set forth by the mount 
program for user mounts.
+
+   
+   Some samba client tools like smbclient(8) honour client-side
+   configuration parameters present in smb.conf. Unlike those
+   client tools, mount.cifs ignores smb.conf
+   completely.
+   
+
 
 
 


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-266-g9aebdc2

2009-07-07 Thread Jeff Layton
The branch, master has been updated
   via  9aebdc25010548c00d64b02f827c80a6e8fee9bf (commit)
  from  a28596964b44f20d794999541d38fe4bae64b56b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 9aebdc25010548c00d64b02f827c80a6e8fee9bf
Author: Shirish Pargaonkar 
Date:   Tue Jul 7 16:35:06 2009 -0400

mount.cifs: clarify mapchars option

Signed-off-by: Shirish Pargaonkar 
Signed-off-by: Jeff Layton 

---

Summary of changes:
 docs-xml/manpages-3/mount.cifs.8.xml |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/mount.cifs.8.xml 
b/docs-xml/manpages-3/mount.cifs.8.xml
index 6461d82..9383f3f 100644
--- a/docs-xml/manpages-3/mount.cifs.8.xml
+++ b/docs-xml/manpages-3/mount.cifs.8.xml
@@ -344,7 +344,9 @@ permissions in memory that can't be stored on the server. 
This information can d
 (which also forbids creating and opening files
 whose names contain any of these seven characters).
 This has no effect if the server does not support
-Unicode on the wire.
+Unicode on the wire. Please note that the files created
+   with mapchars mount option may not be accessible
+   if the share is mounted without that option.
 
 
 


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-273-g31bd627

2009-07-08 Thread Jeff Layton
The branch, master has been updated
   via  31bd62727dcba38c101ea0035f4b2898571ab149 (commit)
  from  57afa1edebe38ea48be5fc074a8284c762e35e17 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 31bd62727dcba38c101ea0035f4b2898571ab149
Author: Shirish Pargaonkar 
Date:   Wed Jul 8 07:43:43 2009 -0400

docs: flesh out options section of umount.cifs manpage

Signed-off-by: Shirish Pargaonkar 
Signed-off-by: Jeff Layton 

---

Summary of changes:
 docs-xml/manpages-3/umount.cifs.8.xml |   56 
 1 files changed, 49 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/umount.cifs.8.xml 
b/docs-xml/manpages-3/umount.cifs.8.xml
index d845d38..319c437 100644
--- a/docs-xml/manpages-3/umount.cifs.8.xml
+++ b/docs-xml/manpages-3/umount.cifs.8.xml
@@ -54,14 +54,56 @@ can rely on specifying explicit entries in /etc/fstab 
See
 
OPTIONS

-
---verbose
-print additional debugging 
information
-
-
---no-mtab
+   
+-V
+Print version and exit.
+   
+   
+-h
+Print help message and exit.
+   
+   
+-r
+In case unmounting fails, try to remount
+   read-only.
+   
+   
+-d
+In case the unmounted device was a loop device,
+also free this loop device.
+   
+   
+-f
+Force unmount (in case of an unreachable
+   server).
+   
+   
+-l
+Lazy unmount. Detach the filesystem from
+   the filesysetm hierarchy now, and
+   cleanup all references to the filesystem
+   as soon as it is not busy 
anymore.
+   
+   
+-e
+Mark the mount point as expired.  If a mount
+   point is not currently in use, then an initial
+   call to unmount with this flag fails with the
+   error EAGAIN, but marks the mount point as
+   expired.  The mount point remains expired as
+   long as it isn't accessed by any process.
+   A second unmount call specifying -e unmounts
+   an expired mount point.  This flag cannot be
+   specified with either -f or -l
+   
+   
+-v|--verbose
+Verbose Mode. Print additional debugging 
information
+   
+   
+-n|--no-mtab
 Do not update the mtab even if unmount 
completes successfully (/proc/mounts will still display the correct 
information)
-
+   
 

 


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-291-g8d1b061

2009-07-09 Thread Jeff Layton
The branch, master has been updated
   via  8d1b061b517176e172151e6814083aa7a7051d56 (commit)
  from  f1fad2efe4daf95ad77db6251ad5d77fb9ef755c (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 8d1b061b517176e172151e6814083aa7a7051d56
Author: Jeff Layton 
Date:   Thu Jul 9 21:04:08 2009 -0400

cifs.upcall: use pid value from kernel to determine KRB5CCNAME to use

If the kernel sends the upcall a pid of the requesting process, we can
open that process' /proc//environ file and scrape the KRB5CCNAME
value out of it.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/cifs.upcall.c |   87 +++---
 1 files changed, 75 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/cifs.upcall.c b/client/cifs.upcall.c
index 4110de3..e592a4f 100644
--- a/client/cifs.upcall.c
+++ b/client/cifs.upcall.c
@@ -1,6 +1,7 @@
 /*
 * CIFS user-space helper.
 * Copyright (C) Igor Mammedov (niall...@gmail.com) 2007
+* Copyright (C) Jeff Layton (jlay...@redhat.com) 2009
 *
 * Used by /sbin/request-key for handling
 * cifs upcall for kerberos authorization of access to share and
@@ -38,6 +39,54 @@ typedef enum _secType {
 } secType_t;
 
 /*
+ * given a process ID, get the value of the KRB5CCNAME environment variable
+ * in the context of that process. On error, just return NULL.
+ */
+static char *
+get_krb5_ccname(pid_t pid)
+{
+   int fd;
+   ssize_t len, left;
+
+   /*
+* FIXME: sysconf for ARG_MAX instead? Kernel seems to be limited to a
+* page however, so it may not matter.
+*/
+   char buf[4096];
+   char *p, *value = NULL;
+   
+   buf[4095] = '\0';
+   snprintf(buf, 4095, "/proc/%d/environ", pid);
+   fd = open(buf, O_RDONLY);
+   if (fd < 0)
+   return NULL;
+
+   /* FIXME: don't assume that we get it all in the first read? */
+   len = read(fd, buf, 4096);
+   close(fd);
+   if (len < 0)
+   return NULL;
+
+   left = len;
+   p = buf;
+
+   /* can't have valid KRB5CCNAME if there are < 13 bytes left */
+   while (left > 12) {
+   if (strncmp("KRB5CCNAME=", p, 11)) {
+   p += strnlen(p, left);
+   ++p;
+   left = buf + len - p;
+   continue;
+   }
+   p += 11;
+   left -= 11;
+   value = strndup(p, left);
+   break;
+   }
+   return value;
+}
+
+/*
  * Prepares AP-REQ data for mechToken and gets session key
  * Uses credentials from cache. It will not ask for password
  * you should receive credentials for yuor name manually using
@@ -58,15 +107,15 @@ typedef enum _secType {
  * ret: 0 - success, others - failure
 */
 static int
-handle_krb5_mech(const char *oid, const char *principal,
-DATA_BLOB * secblob, DATA_BLOB * sess_key)
+handle_krb5_mech(const char *oid, const char *principal, DATA_BLOB *secblob,
+DATA_BLOB *sess_key, const char *ccname)
 {
int retval;
DATA_BLOB tkt, tkt_wrapped;
 
/* get a kerberos ticket for the service and extract the session key */
-   retval = cli_krb5_get_ticket(principal, 0,
-&tkt, sess_key, 0, NULL, NULL);
+   retval = cli_krb5_get_ticket(principal, 0, &tkt, sess_key, 0, ccname,
+NULL);
 
if (retval)
return retval;
@@ -88,11 +137,12 @@ handle_krb5_mech(const char *oid, const char *principal,
 #define DKD_HAVE_IPV4  8
 #define DKD_HAVE_IPV6  16
 #define DKD_HAVE_UID   32
+#define DKD_HAVE_PID   64
 #define DKD_MUSTHAVE_SET (DKD_HAVE_HOSTNAME|DKD_HAVE_VERSION|DKD_HAVE_SEC)
 
 static int
-decode_key_description(const char *desc, int *ver, secType_t * sec,
-  char **hostname, uid_t * uid)
+decode_key_description(const char *desc, int *ver, secType_t *sec,
+  char **hostname, uid_t *uid, pid_t *pid)
 {
int retval = 0;
char *pos;
@@ -117,6 +167,16 @@ decode_key_description(const char *desc, int *ver, 
secType_t * sec,
/* BB: do we need it if we have hostname already? */
} else if (strncmp(tkn, "ipv6=", 5) == 0) {
/* BB: do we need it if we have hostname already? */
+   } else if (strncmp(tkn, "pid=", 4) == 0) {
+   errno = 0;
+   *pid = strtol(tkn + 4, NULL, 0);
+   if (errno != 0) {
+   syslog(LOG_WAR

[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-628-ga869e42

2009-07-27 Thread Jeff Layton
The branch, master has been updated
   via  a869e4253a87f9a5e13dbe87b2799f8683d238d7 (commit)
  from  b676e63a520e644e2737b55a61244fa8df9a10dc (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit a869e4253a87f9a5e13dbe87b2799f8683d238d7
Author: Shirish Pargaonkar 
Date:   Mon Jul 27 12:02:35 2009 -0400

umount.cifs: do not attempt to update /etc/mtab if it is symbolic link

If /etc/mtab is a symbolic link to e.g. /proc/mounts, do not update it.

This is a fix for a bug reported in 4675 on samba bugzilla

Signed-off-by: Shirish Pargaonkar 

---

Summary of changes:
 client/umount.cifs.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/umount.cifs.c b/client/umount.cifs.c
index 0005054..35563c1 100644
--- a/client/umount.cifs.c
+++ b/client/umount.cifs.c
@@ -146,9 +146,11 @@ static int remove_from_mtab(char * mountpoint)
FILE * org_fd;
FILE * new_fd;
struct mntent * mount_entry;
+   struct stat statbuf;
 
-   /* Do we need to check if it is a symlink to e.g. /proc/mounts
-   in which case we probably do not want to update it? */
+   /* If it is a symlink, e.g. to /proc/mounts, no need to update it. */
+   if ((lstat(MOUNTED, &statbuf) == 0) && (S_ISLNK(statbuf.st_mode)))
+   return 0;
 
/* Do we first need to check if it is writable? */ 
 
@@ -162,7 +164,6 @@ static int remove_from_mtab(char * mountpoint)
printf("attempting to remove from mtab\n");
 
org_fd = setmntent(MOUNTED, "r");
-
if(org_fd == NULL) {
printf("Can not open %s\n",MOUNTED);
unlock_mtab();


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-994-g19553e1

2009-08-14 Thread Jeff Layton
The branch, master has been updated
   via  19553e1552a57d5b0a9f3514bf64d2580b76a377 (commit)
   via  2f95ccc1e2c7fe8efd341cd6fc5adc402a7a0a18 (commit)
   via  acbf026012af1c87b680b8d80ea9e4123e24b91a (commit)
   via  b10bdef4e75ffe48d563b2f0825b82519a71c9a7 (commit)
   via  750ceb82390bd490bfd0431d52cd83b11201d548 (commit)
   via  685fdc33d705b0d5cbb43f16cdcb2dccd85a652e (commit)
   via  378a2d9aa5e538144083ff53578af6105cd296c9 (commit)
  from  168a7cb6a893fb56ef9fe7a4dc99bbc117a75962 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 19553e1552a57d5b0a9f3514bf64d2580b76a377
Author: Jeff Layton 
Date:   Fri Aug 14 07:59:51 2009 -0400

cifs.upcall: fix IPv6 addrs sent to upcall to have colon delimiters

Current kernels don't send IPv6 addresses with the colon delimiters, add
a routine to add them when they're not present.

Signed-off-by: Jeff Layton 

commit 2f95ccc1e2c7fe8efd341cd6fc5adc402a7a0a18
Author: Jeff Layton 
Date:   Fri Aug 14 07:59:50 2009 -0400

cifs.upcall: use ip address passed by kernel to get server's hostname

Instead of using the hostname given by the upcall to get the server's
principal, take the IP address given in the upcall and reverse resolve
it to a hostname.

    Signed-off-by: Jeff Layton 

commit acbf026012af1c87b680b8d80ea9e4123e24b91a
Author: Jeff Layton 
Date:   Fri Aug 14 07:59:50 2009 -0400

cifs.upcall: clean up flag handling

Add a new stack var to hold the flags returned by the decoder routine
so that we don't need to worry so much about preserving "rc".

With this, we can drop privs before trying to find the location of
the credcache.

Signed-off-by: Jeff Layton 

commit b10bdef4e75ffe48d563b2f0825b82519a71c9a7
Author: Jeff Layton 
Date:   Fri Aug 14 07:59:50 2009 -0400

cifs.upcall: try getting a "cifs/" principal and fall back to "host/"

cifs.upcall takes a "-c" flag that tells the upcall to get a principal
in the form of "cifs/hostname.example@realm" instead of
"host/hostname.example@realm". This has turned out to be a source of
great confusion for users.

Instead of requiring this flag, have the upcall try to get a "cifs/"
principal first. If that fails, fall back to getting a "host/"
principal.

Signed-off-by: Jeff Layton 

commit 750ceb82390bd490bfd0431d52cd83b11201d548
Author: Jeff Layton 
Date:   Fri Aug 14 07:59:49 2009 -0400

cifs.upcall: declare a structure for holding decoded args

The argument list for the decoder is becoming rather long. Declare an
args structure and use that for holding the args. This also simplifies
pointer handling a bit.

Signed-off-by: Jeff Layton 

commit 685fdc33d705b0d5cbb43f16cdcb2dccd85a652e
Author: Jeff Layton 
Date:   Fri Aug 14 07:59:49 2009 -0400

cifs.upcall: formatting cleanup
    
Clean up some unneeded curly braces, and fix some indentation.

Signed-off-by: Jeff Layton 

commit 378a2d9aa5e538144083ff53578af6105cd296c9
Author: Jeff Layton 
Date:   Fri Aug 14 07:59:49 2009 -0400

cifs.upcall: clean up logging and add debug messages

Change the log levels to be more appropriate to the messages being
logged. Error messages should be LOG_ERR and not LOG_WARNING, for
instance.

Add some LOG_DEBUG messages that we can use to diagnose problems with
krb5 upcalls. With these, someone can set up syslog to log daemon.debug
and should be able to get more info when things aren't working.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/cifs.upcall.c  |  321 +
 docs-xml/manpages-3/cifs.upcall.8.xml |4 +-
 2 files changed, 203 insertions(+), 122 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/cifs.upcall.c b/client/cifs.upcall.c
index 82b9f7b..c89df9c 100644
--- a/client/cifs.upcall.c
+++ b/client/cifs.upcall.c
@@ -30,13 +30,13 @@ create dns_resolver * * /usr/local/sbin/cifs.upcall %k
 
 #include "cifs_spnego.h"
 
-const char *CIFSSPNEGO_VERSION = "1.2";
+const char *CIFSSPNEGO_VERSION = "1.3";
 static const char *prog = "cifs.upcall";
-typedef enum _secType {
+typedef enum _sectype {
NONE = 0,
KRB5,
MS_KRB5
-} secType_t;
+} sectype_t;
 
 /*
  * given a process ID, get the value of the KRB5CCNAME environment variable
@@ -58,14 +58,20 @@ get_krb5_ccname(pid_t pid)
buf[4095] = '\0';
snprintf(buf, 4095, "/proc/%d/environ", pid);
fd = open(buf, O_RDONLY);
-   if (fd < 0)
+   if (fd < 0) {
+   sysl

[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-1189-gda99e3a

2009-08-26 Thread Jeff Layton
The branch, master has been updated
   via  da99e3a724b493ba47a06d0704b891819ad16647 (commit)
   via  3544e685ade5b331e473c8680d42a748d9389125 (commit)
  from  1a97bd915dfe90b40ec03617af3d8d25483af9c9 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit da99e3a724b493ba47a06d0704b891819ad16647
Author: Jeff Layton 
Date:   Wed Aug 26 06:26:02 2009 -0400

cifs.upcall: make using ip address conditional on new option

Igor Mammedov pointed out that reverse resolving an IP address to get
the hostname portion of a principal could open a possible attack
vector. If an attacker were to gain control of DNS, then he could
redirect the mount to a server of his choosing, and fix the reverse
resolution to point to a hostname of his choosing (one where he has
the key for the corresponding cifs/ or host/ principal).

That said, we often trust DNS for other reasons and it can be useful
to do so. Make the code that allows trusting DNS to be enabled by
adding --trust-dns to the cifs.upcall invocation.

Signed-off-by: Jeff Layton 

commit 3544e685ade5b331e473c8680d42a748d9389125
Author: Jeff Layton 
Date:   Wed Aug 26 06:15:42 2009 -0400

cifs.upcall: switch to getopt_long

...to allow long option names.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/cifs.upcall.c  |   68 ++---
 docs-xml/manpages-3/cifs.upcall.8.xml |   15 +--
 2 files changed, 56 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/cifs.upcall.c b/client/cifs.upcall.c
index c89df9c..1645322 100644
--- a/client/cifs.upcall.c
+++ b/client/cifs.upcall.c
@@ -27,6 +27,7 @@ create dns_resolver * * /usr/local/sbin/cifs.upcall %k
 
 #include "includes.h"
 #include 
+#include 
 
 #include "cifs_spnego.h"
 
@@ -153,9 +154,9 @@ handle_krb5_mech(const char *oid, const char *principal, 
DATA_BLOB *secblob,
 #define DKD_HAVE_IP0x8
 #define DKD_HAVE_UID   0x10
 #define DKD_HAVE_PID   0x20
-#define DKD_MUSTHAVE_SET (DKD_HAVE_IP|DKD_HAVE_VERSION|DKD_HAVE_SEC)
+#define DKD_MUSTHAVE_SET (DKD_HAVE_HOSTNAME|DKD_HAVE_VERSION|DKD_HAVE_SEC)
 
-static struct decoded_args {
+struct decoded_args {
int ver;
char*hostname;
char*ip;
@@ -353,10 +354,16 @@ ip_to_fqdn(const char *addrstr, char *host, size_t 
hostlen)
 static void
 usage(void)
 {
-   syslog(LOG_INFO, "Usage: %s [-v] key_serial", prog);
-   fprintf(stderr, "Usage: %s [-v] key_serial\n", prog);
+   syslog(LOG_INFO, "Usage: %s [-t] [-v] key_serial", prog);
+   fprintf(stderr, "Usage: %s [-t] [-v] key_serial\n", prog);
 }
 
+const struct option long_options[] = {
+   { "trust-dns",  0, NULL, 't' },
+   { "version",0, NULL, 'v' },
+   { NULL, 0, NULL, 0 }
+};
+
 int main(const int argc, char *const argv[])
 {
struct cifs_spnego_msg *keydata = NULL;
@@ -366,19 +373,24 @@ int main(const int argc, char *const argv[])
size_t datalen;
unsigned int have;
long rc = 1;
-   int c;
-   char *buf, *princ, *ccname = NULL;
-   char hostbuf[NI_MAXHOST];
+   int c, try_dns = 0;
+   char *buf, *princ = NULL, *ccname = NULL;
+   char hostbuf[NI_MAXHOST], *host;
struct decoded_args arg = { };
const char *oid;
 
+   hostbuf[0] = '\0';
+
openlog(prog, 0, LOG_DAEMON);
 
-   while ((c = getopt(argc, argv, "cv")) != -1) {
+   while ((c = getopt_long(argc, argv, "ctv", long_options, NULL)) != -1) {
switch (c) {
case 'c':
/* legacy option -- skip it */
break;
+   case 't':
+   try_dns++;
+   break;
case 'v':
printf("version: %s\n", CIFSSPNEGO_VERSION);
goto out;
@@ -446,21 +458,18 @@ int main(const int argc, char *const argv[])
if (have & DKD_HAVE_PID)
ccname = get_krb5_ccname(arg.pid);
 
-   if (have & DKD_HAVE_IP) {
-   rc = ip_to_fqdn(arg.ip, hostbuf, sizeof(hostbuf));
-   if (rc)
-   goto out;
-   }
+   host = arg.hostname;
 
// do mech specific authorization
switch (arg.sec) {
case MS_KRB5:
case KRB5:
+retry_new_hostname:
/* for "cifs/" service name + terminating 0 */
-   datalen = strnlen(hostbuf, sizeof(hostbuf)) + 5 + 1;
+   datalen = strlen(host) + 5 + 1;

[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-1377-g704b739

2009-09-04 Thread Jeff Layton
The branch, master has been updated
   via  704b739ad8b5441e4c84215044a77e74e54cf425 (commit)
  from  ffd48a79ee34dc90c0f6f16564c3a0de8b53d3d2 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 704b739ad8b5441e4c84215044a77e74e54cf425
Author: Jeff Layton 
Date:   Fri Sep 4 06:29:44 2009 -0400

cifs.upcall: do a brute-force search for KRB5 credcache

A few weeks ago, I added some code to cifs.upcall to take the pid sent
by the kernel and use that to get the value of the $KRB5CCNAME
environment var for the process. That works fine on the initial mount,
but could be problematic on reconnect.

There's no guarantee on a reconnect that the process that initiates the
upcall will have $KRB5CCNAME pointed at the correct credcache. Because
of this, the current scheme isn't going to be reliable enough and we
need to use something different.

This patch replaces that scheme with one very similar to the one used by
rpc.gssd in nfs-utils. It searches the credcache dir (currently
hardcoded to /tmp) for a valid credcache for the given uid. If it finds
one then it uses that as the credentials cache. If it finds more than
one, it uses the one with the latest TGT expiration.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/cifs.upcall.c |  186 +-
 1 files changed, 139 insertions(+), 47 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/cifs.upcall.c b/client/cifs.upcall.c
index 1645322..71e60c6 100644
--- a/client/cifs.upcall.c
+++ b/client/cifs.upcall.c
@@ -31,6 +31,11 @@ create dns_resolver * * /usr/local/sbin/cifs.upcall %k
 
 #include "cifs_spnego.h"
 
+#defineCIFS_DEFAULT_KRB5_DIR   "/tmp"
+#defineCIFS_DEFAULT_KRB5_PREFIX"krb5cc_"
+
+#defineMAX_CCNAME_LEN  PATH_MAX + 5
+
 const char *CIFSSPNEGO_VERSION = "1.3";
 static const char *prog = "cifs.upcall";
 typedef enum _sectype {
@@ -39,60 +44,148 @@ typedef enum _sectype {
MS_KRB5
 } sectype_t;
 
-/*
- * given a process ID, get the value of the KRB5CCNAME environment variable
- * in the context of that process. On error, just return NULL.
- */
-static char *
-get_krb5_ccname(pid_t pid)
+static inline int
+k5_data_equal(krb5_data d1, krb5_data d2, unsigned int length)
 {
-   int fd;
-   ssize_t len, left;
+   if (!length)
+   length = d1.length;
 
-   /*
-* FIXME: sysconf for ARG_MAX instead? Kernel seems to be limited to a
-* page however, so it may not matter.
-*/
-   char buf[4096];
-   char *p, *value = NULL;
-   
-   buf[4095] = '\0';
-   snprintf(buf, 4095, "/proc/%d/environ", pid);
-   fd = open(buf, O_RDONLY);
-   if (fd < 0) {
-   syslog(LOG_DEBUG, "%s: unable to open %s: %d", __func__, buf,
-   errno);
-   return NULL;
+   return (d1.length == length &&
+   d1.length == d2.length &&
+   memcmp(d1.data, d2.data, length) == 0);
+
+}
+
+/* does the ccache have a valid TGT? */
+static time_t
+get_tgt_time(const char *ccname) {
+   krb5_context context;
+   krb5_ccache ccache;
+   krb5_cc_cursor cur;
+   krb5_creds creds;
+   krb5_principal principal;
+   krb5_data tgt = { .data =   "krbtgt",
+ .length = 6 };
+   time_t credtime = 0;
+
+   if (krb5_init_context(&context)) {
+   syslog(LOG_DEBUG, "%s: unable to init krb5 context", __func__);
+   return 0;
}
 
-   /* FIXME: don't assume that we get it all in the first read? */
-   len = read(fd, buf, 4096);
-   close(fd);
-   if (len < 0) {
-   syslog(LOG_DEBUG, "%s: unable to read from /proc/%d/environ: "
- "%d", __func__, pid, errno);
+   if (krb5_cc_resolve(context, ccname, &ccache)) {
+   syslog(LOG_DEBUG, "%s: unable to resolve krb5 cache", __func__);
+   goto err_cache;
+   }
+
+   if (krb5_cc_set_flags(context, ccache, 0)) {
+   syslog(LOG_DEBUG, "%s: unable to set flags", __func__);
+   goto err_cache;
+   }
+
+   if (krb5_cc_get_principal(context, ccache, &principal)) {
+   syslog(LOG_DEBUG, "%s: unable to get principal", __func__);
+   goto err_princ;
+   }
+
+   if (krb5_cc_start_seq_get(context, ccache, &cur)) {
+   syslog(LOG_DEBUG, "%s: unable to seq start", __func__);
+   goto err_c

[SCM] Samba Shared Repository - branch master updated - tevent-0-9-8-709-g3aa147f

2009-09-24 Thread Jeff Layton
The branch, master has been updated
   via  3aa147f8d20bc5124dca1f4746da678a55247b82 (commit)
  from  1e4868d251a4546c92ec275e37e9c5e11f30d1b8 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 3aa147f8d20bc5124dca1f4746da678a55247b82
Author: Jeff Layton 
Date:   Thu Sep 24 20:55:43 2009 -0400

mount.cifs: print output to stderr

When a mount fails, mount.cifs often prints an error message. In most
cases, this error goes to stdout instead of stderr like it should. Fix
it to print errors to stderr instead.

Reported-by: Jan Engelhardt 
Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/mount.cifs.c |  209 +--
 1 files changed, 101 insertions(+), 108 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/mount.cifs.c b/client/mount.cifs.c
index 4387f59..1c04e13 100644
--- a/client/mount.cifs.c
+++ b/client/mount.cifs.c
@@ -273,31 +273,34 @@ BB end finish BB */
 static char * check_for_domain(char **);
 
 
-static void mount_cifs_usage(void)
+static void mount_cifs_usage(FILE *stream)
 {
-   printf("\nUsage:  %s   -o \n", thisprogram);
-   printf("\nMount the remote target, specified as a UNC name,");
-   printf(" to a local directory.\n\nOptions:\n");
-   printf("\tuser=\n\tpass=\n\tdom=\n");
-   printf("\nLess commonly used options:");
-   
printf("\n\tcredentials=,guest,perm,noperm,setuids,nosetuids,rw,ro,");
-   
printf("\n\tsep=,iocharset=,suid,nosuid,exec,noexec,serverino,");
-   
printf("\n\tmapchars,nomapchars,nolock,servernetbiosname=");
-   printf("\n\tdirectio,nounix,cifsacl,sec=,sign");
-   printf("\n\nOptions not needed for servers supporting CIFS Unix 
extensions");
-   printf("\n\t(e.g. unneeded for mounts to most Samba versions):");
-   printf("\n\tuid=,gid=,dir_mode=,file_mode=,sfu");
-   printf("\n\nRarely used options:");
-   
printf("\n\tport=,rsize=,wsize=,unc=,ip=,");
-   
printf("\n\tdev,nodev,nouser_xattr,netbiosname=,hard,soft,intr,");
-   
printf("\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=,nobrl");
-   printf("\n\tin6_addr");
-   printf("\n\nOptions are described in more detail in the manual page");
-   printf("\n\tman 8 mount.cifs\n");
-   printf("\nTo display the version number of the mount helper:");
-   printf("\n\t%s -V\n",thisprogram);
+   fprintf(stream, "\nUsage:  %s   -o \n", 
thisprogram);
+   fprintf(stream, "\nMount the remote target, specified as a UNC name,");
+   fprintf(stream, " to a local directory.\n\nOptions:\n");
+   fprintf(stream, "\tuser=\n\tpass=\n\tdom=\n");
+   fprintf(stream, "\nLess commonly used options:");
+   fprintf(stream, 
"\n\tcredentials=,guest,perm,noperm,setuids,nosetuids,rw,ro,");
+   fprintf(stream, 
"\n\tsep=,iocharset=,suid,nosuid,exec,noexec,serverino,");
+   fprintf(stream, 
"\n\tmapchars,nomapchars,nolock,servernetbiosname=");
+   fprintf(stream, "\n\tdirectio,nounix,cifsacl,sec=,sign");
+   fprintf(stream, "\n\nOptions not needed for servers supporting CIFS 
Unix extensions");
+   fprintf(stream, "\n\t(e.g. unneeded for mounts to most Samba 
versions):");
+   fprintf(stream, 
"\n\tuid=,gid=,dir_mode=,file_mode=,sfu");
+   fprintf(stream, "\n\nRarely used options:");
+   fprintf(stream, 
"\n\tport=,rsize=,wsize=,unc=,ip=,");
+   fprintf(stream, 
"\n\tdev,nodev,nouser_xattr,netbiosname=,hard,soft,intr,");
+   fprintf(stream, 
"\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=,nobrl");
+   fprintf(stream, "\n\nOptions are described in more detail in the manual 
page");
+   fprintf(stream, "\n\tman 8 mount.cifs\n");
+   fprintf(stream, "\nTo display the version number of the mount helper:");
+   fprintf(stream, "\n\t%s -V\n",thisprogram);
 
SAFE_FREE(mountpassword);
+
+   if (stream == stderr)
+   exit(EX_USAGE);
+   exit(0);
 }
 
 /* caller frees username if necessary */
@@ -348,7 +351,7 @@ static int open_cred_file(char * file_name)
}
}
if(length > 4086) {
-   printf("mount.cifs failed due to 
malformed username in credentials file");
+   fprintf(stderr, "mount

[SCM] Samba Shared Repository - branch v3-5-test updated - release-4-0-0alpha8-1464-g56f5886

2009-09-25 Thread Jeff Layton
The branch, v3-5-test has been updated
   via  56f58860020151cdb720b865b9338d86320f73a6 (commit)
  from  50268ab18489b3508cf2ef35069dc0bcb585fbd9 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -
commit 56f58860020151cdb720b865b9338d86320f73a6
Author: Jeff Layton 
Date:   Fri Sep 25 06:47:39 2009 -0400

mount.cifs: print output to stderr

When a mount fails, mount.cifs often prints an error message. In most
cases, this error goes to stdout instead of stderr like it should. Fix
it to print errors to stderr instead.

Reported-by: Jan Engelhardt 
Signed-off-by: Jeff Layton 

---

Summary of changes:
 client/mount.cifs.c |  209 +--
 1 files changed, 101 insertions(+), 108 deletions(-)


Changeset truncated at 500 lines:

diff --git a/client/mount.cifs.c b/client/mount.cifs.c
index 4387f59..1c04e13 100644
--- a/client/mount.cifs.c
+++ b/client/mount.cifs.c
@@ -273,31 +273,34 @@ BB end finish BB */
 static char * check_for_domain(char **);
 
 
-static void mount_cifs_usage(void)
+static void mount_cifs_usage(FILE *stream)
 {
-   printf("\nUsage:  %s   -o \n", thisprogram);
-   printf("\nMount the remote target, specified as a UNC name,");
-   printf(" to a local directory.\n\nOptions:\n");
-   printf("\tuser=\n\tpass=\n\tdom=\n");
-   printf("\nLess commonly used options:");
-   
printf("\n\tcredentials=,guest,perm,noperm,setuids,nosetuids,rw,ro,");
-   
printf("\n\tsep=,iocharset=,suid,nosuid,exec,noexec,serverino,");
-   
printf("\n\tmapchars,nomapchars,nolock,servernetbiosname=");
-   printf("\n\tdirectio,nounix,cifsacl,sec=,sign");
-   printf("\n\nOptions not needed for servers supporting CIFS Unix 
extensions");
-   printf("\n\t(e.g. unneeded for mounts to most Samba versions):");
-   printf("\n\tuid=,gid=,dir_mode=,file_mode=,sfu");
-   printf("\n\nRarely used options:");
-   
printf("\n\tport=,rsize=,wsize=,unc=,ip=,");
-   
printf("\n\tdev,nodev,nouser_xattr,netbiosname=,hard,soft,intr,");
-   
printf("\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=,nobrl");
-   printf("\n\tin6_addr");
-   printf("\n\nOptions are described in more detail in the manual page");
-   printf("\n\tman 8 mount.cifs\n");
-   printf("\nTo display the version number of the mount helper:");
-   printf("\n\t%s -V\n",thisprogram);
+   fprintf(stream, "\nUsage:  %s   -o \n", 
thisprogram);
+   fprintf(stream, "\nMount the remote target, specified as a UNC name,");
+   fprintf(stream, " to a local directory.\n\nOptions:\n");
+   fprintf(stream, "\tuser=\n\tpass=\n\tdom=\n");
+   fprintf(stream, "\nLess commonly used options:");
+   fprintf(stream, 
"\n\tcredentials=,guest,perm,noperm,setuids,nosetuids,rw,ro,");
+   fprintf(stream, 
"\n\tsep=,iocharset=,suid,nosuid,exec,noexec,serverino,");
+   fprintf(stream, 
"\n\tmapchars,nomapchars,nolock,servernetbiosname=");
+   fprintf(stream, "\n\tdirectio,nounix,cifsacl,sec=,sign");
+   fprintf(stream, "\n\nOptions not needed for servers supporting CIFS 
Unix extensions");
+   fprintf(stream, "\n\t(e.g. unneeded for mounts to most Samba 
versions):");
+   fprintf(stream, 
"\n\tuid=,gid=,dir_mode=,file_mode=,sfu");
+   fprintf(stream, "\n\nRarely used options:");
+   fprintf(stream, 
"\n\tport=,rsize=,wsize=,unc=,ip=,");
+   fprintf(stream, 
"\n\tdev,nodev,nouser_xattr,netbiosname=,hard,soft,intr,");
+   fprintf(stream, 
"\n\tnointr,ignorecase,noposixpaths,noacl,prefixpath=,nobrl");
+   fprintf(stream, "\n\nOptions are described in more detail in the manual 
page");
+   fprintf(stream, "\n\tman 8 mount.cifs\n");
+   fprintf(stream, "\nTo display the version number of the mount helper:");
+   fprintf(stream, "\n\t%s -V\n",thisprogram);
 
SAFE_FREE(mountpassword);
+
+   if (stream == stderr)
+   exit(EX_USAGE);
+   exit(0);
 }
 
 /* caller frees username if necessary */
@@ -348,7 +351,7 @@ static int open_cred_file(char * file_name)
}
}
if(length > 4086) {
-   printf("mount.cifs failed due to 
malformed username in credentials file");
+   fprintf(stderr, "mount

[SCM] Samba Shared Repository - branch master updated

2010-03-08 Thread Jeff Layton
The branch, master has been updated
   via  f4cb528... samba: remove cifs-utils tools from build systems
  from  4e16a28... LDB:common - Change counters to "unsigned" where 
appropriate

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit f4cb528ac510d3381a92a303e858edaf9e3d908a
Author: Jeff Layton 
Date:   Mon Mar 8 09:06:40 2010 -0500

samba: remove cifs-utils tools from build systems

Now that cifs-utils are their own project, we need to go ahead and pull
them out of the samba tree. This patch represents the first step toward
that end.

Remove the cifs-utilities from the source3 and source4 builds. Please
pay particular attention to the source4 piece. I'm not at all familiar
with the build system there, and would appreciate someone sanity
checking my changes.

It also adds a small README.cifs-utils file in the topdir. This is
optional, but I think it's a good idea to carry this for a release or
two.

Once this patch looks ok, I'll plan to do another patch to actually
remove the client dir and the relevant docs-xml files from the tree
altogether.
    
Signed-off-by: Jeff Layton 

---

Summary of changes:
 source3/Makefile.in  |   54 ++--
 source3/configure.in |  124 --
 source4/client/config.m4 |   13 -
 source4/client/config.mk |   16 --
 source4/configure.ac |1 -
 5 files changed, 5 insertions(+), 203 deletions(-)
 delete mode 100644 source4/client/config.m4


Changeset truncated at 500 lines:

diff --git a/source3/Makefile.in b/source3/Makefile.in
index de70c27..739eeda 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -208,8 +208,6 @@ PATH_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
 
 SBIN_PROGS = bin/s...@exeext@ bin/n...@exeext@ @SWAT_SBIN_TARGETS@ 
@EXTRA_SBIN_PROGS@
 
-ROOT_SBIN_PROGS = @CIFSMOUNT_PROGS@ @CIFSUMOUNT_PROGS@
-
 BIN_PROGS1 = bin/smbcli...@exeext@ bin/n...@exeext@ bin/smbsp...@exeext@ \
bin/testp...@exeext@ bin/smbsta...@exeext@ bin/smb...@exeext@
 BIN_PROGS2 = bin/smbcont...@exeext@ bin/smbt...@exeext@ $(TDBBACKUP) \
@@ -1039,12 +1037,6 @@ CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) 
$(LDB_OBJ) \
  $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
  $(LIBNDR_GEN_OBJ0)
 
-CIFS_MOUNT_OBJ = ../client/mount.cifs.o ../client/mtab.o
-
-CIFS_UMOUNT_OBJ = ../client/umount.cifs.o ../client/mtab.o
-
-CIFS_UPCALL_OBJ = ../client/cifs.upcall.o
-
 NMBLOOKUP_OBJ = utils/nmblookup.o $(PARAM_OBJ) $(LIBNMB_OBJ) \
$(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) $(LIBSMB_ERR_OBJ)
 
@@ -1358,8 +1350,8 @@ SPLIT_TOKENS_OBJ = utils/split_tokens.o \
 ##
 # now the rules...
 ##
-all:: SHOWFLAGS basics libs $(SBIN_PROGS) $(BIN_PROGS) $(ROOT_SBIN_PROGS) \
-   $(MODULES) $(NSS_MODULES) $(PAM_MODULES) @CIFSUPCALL_PROGS@ \
+all:: SHOWFLAGS basics libs $(SBIN_PROGS) $(BIN_PROGS) \
+   $(MODULES) $(NSS_MODULES) $(PAM_MODULES) \
$(EXTRA_ALL_TARGETS)
 
 basics::
@@ -1620,21 +1612,6 @@ bin/smbsp...@exeext@: $(BINARY_PREREQS) $(CUPS_OBJ) 
@BUILD_POPT@ $(LIBTALLOC) $(
@LIBWBCLIENT_STATIC@ $(LIBWBCLIENT_LIBS) \
$(KRB5LIBS) $(LDAP_LIBS) $(POPT_LIBS) $(LIBTALLOC_LIBS) 
$(LIBTDB_LIBS) $(ZLIB_LIBS)
 
-bin/mount.c...@exeext@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ)
-   @echo Linking $@
-   @$(CC) -o $@ $(CIFS_MOUNT_OBJ) $(DYNEXP) $(LDFLAGS)
-
-bin/umount.c...@exeext@: $(BINARY_PREREQS) $(CIFS_UMOUNT_OBJ)
-   @echo Linking $@
-   @$(CC) -o $@ $(CIFS_UMOUNT_OBJ) $(DYNEXP) $(LDFLAGS)
-
-bin/cifs.upc...@exeext@: $(BINARY_PREREQS) $(CIFS_UPCALL_OBJ) 
$(LIBSMBCLIENT_OBJ1) $(LIBTALLOC) $(LIBTDB) $(LIBWBCLIENT)
-   @echo Linking $@
-   @$(CC) -o $@ $(CIFS_UPCALL_OBJ) $(DYNEXP) $(LDFLAGS) \
-   $(LIBSMBCLIENT_OBJ1) $(LIBS) -lkeyutils $(KRB5LIBS) \
-   $(LDAP_LIBS) $(LIBTALLOC_LIBS) $(LIBWBCLIENT_LIBS) \
-   $(LIBTDB_LIBS) $(NSCD_LIBS) $(ZLIB_LIBS)
-
 bin/testp...@exeext@: $(BINARY_PREREQS) $(TESTPARM_OBJ) @BUILD_POPT@ 
$(LIBTALLOC) $(LIBTDB)
@echo Linking $@
@$(CC) -o $@ $(TESTPARM_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) \
@@ -2973,7 +2950,7 @@ bin/split_tok...@exeext@: $(BINARY_PREREQS) 
$(SPLIT_TOKENS_OBJ) @BUILD_POPT@ $(L
$(LDAP_LIBS) \
$(LIBTALLOC_LIBS) $(LIBTDB_LIBS)
 
-install:: installservers installbin @INSTALL_CIFSMOUNT@ @INSTALL_CIFSUMOUNT@ 
@INSTALL_CIFSUPCALL@ installman \
+install:: installservers installbin installman \
installscripts installdat installmodules @SWAT_INSTALL_TARGETS@ 
\
@INSTALL

[SCM] Samba Shared Repository - branch master updated

2010-03-08 Thread Jeff Layton
The branch, master has been updated
   via  8a76352... samba: remove Linux cifs-utils files from samba master 
branch
  from  fde707a... s4:"dns_update_list" file: install it properly into the 
private directory

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 8a76352544ccbac7e9aca2c3357256a01493cc7b
Author: Jeff Layton 
Date:   Mon Mar 8 15:05:05 2010 -0500

samba: remove Linux cifs-utils files from samba master branch

This patch removes all of the files from the samba tree that should now
be provided by the cifs-utils package. It also drops a
"README.cifs-utils" into the topdir with a URL to the main cifs-utils
webpage. This is for people who don't want the lists and might be taken
by surprise by the change. That's optional, but I think it's a good idea
for a least a release or two.

Signed-off-by: Jeff Layton 

---

Summary of changes:
 README.cifs-utils |7 +
 client/cifs.upcall.c  |  656 
 client/cifs_spnego.h  |   46 -
 client/mount.cifs.c   | 1779 -
 client/mount.h|   38 -
 client/mtab.c |  220 ---
 client/umount.cifs.c  |  406 -
 docs-xml/Samba3-HOWTO/manpages.xml|2 -
 docs-xml/linux-client/linux-cifs-client-guide.odt |  Bin 126569 -> 0 bytes
 docs-xml/manpages-3/cifs.upcall.8.xml |  124 --
 docs-xml/manpages-3/mount.cifs.8.xml  |  732 -
 docs-xml/manpages-3/umount.cifs.8.xml |  179 ---
 12 files changed, 7 insertions(+), 4182 deletions(-)
 create mode 100644 README.cifs-utils
 delete mode 100644 client/cifs.upcall.c
 delete mode 100644 client/cifs_spnego.h
 delete mode 100644 client/mount.cifs.c
 delete mode 100644 client/mount.h
 delete mode 100644 client/mtab.c
 delete mode 100644 client/umount.cifs.c
 delete mode 100644 docs-xml/linux-client/linux-cifs-client-guide.odt
 delete mode 100644 docs-xml/manpages-3/cifs.upcall.8.xml
 delete mode 100644 docs-xml/manpages-3/mount.cifs.8.xml
 delete mode 100644 docs-xml/manpages-3/umount.cifs.8.xml


Changeset truncated at 500 lines:

diff --git a/README.cifs-utils b/README.cifs-utils
new file mode 100644
index 000..2ea6a38
--- /dev/null
+++ b/README.cifs-utils
@@ -0,0 +1,7 @@
+As of Sunday March 7th, 2010, the Linux CIFS utilities are no longer
+part of the samba suite of tools and have been split off into their own
+project. Please see this webpage for information on how to acquire and
+build them:
+
+http://www.samba.org/linux-cifs/cifs-utils/
+
diff --git a/client/cifs.upcall.c b/client/cifs.upcall.c
deleted file mode 100644
index 42632a0..000
--- a/client/cifs.upcall.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
-* CIFS user-space helper.
-* Copyright (C) Igor Mammedov (niall...@gmail.com) 2007
-* Copyright (C) Jeff Layton (jlay...@redhat.com) 2009
-*
-* Used by /sbin/request-key for handling
-* cifs upcall for kerberos authorization of access to share and
-* cifs upcall for DFS srver name resolving (IPv4/IPv6 aware).
-* You should have keyutils installed and add something like the
-* following lines to /etc/request-key.conf file:
-
-create cifs.spnego * * /usr/local/sbin/cifs.upcall %k
-create dns_resolver * * /usr/local/sbin/cifs.upcall %k
-
-* 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
-* the Free Software Foundation; either version 2 of the License, or
-* (at your option) any later version.
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#include "includes.h"
-#include "../libcli/auth/spnego.h"
-#include "smb_krb5.h"
-#include 
-#include 
-
-#include "cifs_spnego.h"
-
-#defineCIFS_DEFAULT_KRB5_DIR   "/tmp"
-#defineCIFS_DEFAULT_KRB5_PREFIX"krb5cc_"
-
-#defineMAX_CCNAME_LEN  PATH_MAX + 5
-
-const char *CIFSSPNEGO_VERSION = "1.3";
-static const char *prog = "cifs.upcall";
-typedef enum _sectype {
-   NONE = 0,
-   KRB5,
-   MS_KRB5
-} sectype_t;
-
-/* does the ccache have a valid TGT? */
-static time_t
-get_tgt_time(const char *cc

[SCM] Samba Shared Repository - branch master updated

2010-04-02 Thread Jeff Layton
The branch, master has been updated
   via  68403d4... Update URL in README.cifs-utils
  from  7d692f9... s4-rpc: fixed a talloc loop in 
continue_ntlmssp_connection()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 68403d48f8dd1061c4baa60ab23c18d15fe03557
Author: Jeff Layton 
Date:   Fri Apr 2 06:26:09 2010 -0400

Update URL in README.cifs-utils

Signed-off-by: Jeff Layton 

---

Summary of changes:
 README.cifs-utils |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/README.cifs-utils b/README.cifs-utils
index 2ea6a38..6da2ae6 100644
--- a/README.cifs-utils
+++ b/README.cifs-utils
@@ -3,5 +3,5 @@ part of the samba suite of tools and have been split off into 
their own
 project. Please see this webpage for information on how to acquire and
 build them:
 
-http://www.samba.org/linux-cifs/cifs-utils/
+http://linux-cifs.samba.org/cifs-utils/
 


-- 
Samba Shared Repository