Hello community,
here is the log from the commit of package cifs-utils for openSUSE:Factory
checked in at Fri May 7 15:34:38 CEST 2010.
--------
--- cifs-utils/cifs-utils.changes 2010-04-13 17:01:08.000000000 +0200
+++ cifs-utils/cifs-utils.changes 2010-05-04 12:45:48.000000000 +0200
@@ -1,0 +2,10 @@
+Tue May 4 10:36:02 UTC 2010 - sjayaraman@suse.de
+
+- Update to cifs-utils 4.4.
+ + fix a segfault that could occur when parsing the address list.
+ + fix autoconf/automake problem that could cause compilation to fail.
+ + acquire required capabilities before a couple of operations.
+ + ensure passwords are not left in memory.
+ + cleanup of credential file parsing.
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
0002-autoconf-don-not-use-atfooat-constructs-in-Makefile.am.patch
cifs-utils-4.3.tar.bz2
New:
----
cifs-utils-4.4.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ cifs-utils.spec ++++++
--- /var/tmp/diff_new_pack.2m2HSq/_old 2010-05-07 15:33:05.000000000 +0200
+++ /var/tmp/diff_new_pack.2m2HSq/_new 2010-05-07 15:33:05.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package cifs-utils (Version 4.3)
+# spec file for package cifs-utils (Version 4.4)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,7 +19,7 @@
Summary: Utilities for doing and managing mounts of the Linux CIFS filesystem
Name: cifs-utils
-Version: 4.3
+Version: 4.4
Release: 1
License: GPLv3+
Group: System/Filesystems
@@ -28,8 +28,6 @@
Source1: cifs.init
Source2: mkinitrd_scripts_boot-cifs.sh
Source3: mkinitrd_scripts_setup-cifs.sh
-#Patch: 0001-autoconf-define-CAPNG_LDADD-even-when-it-s-not-set.patch
-Patch: 0002-autoconf-don-not-use-atfooat-constructs-in-Makefile.am.patch
%if 0%{?suse_version}
PreReq: insserv %{?fillup_prereq} mkinitrd
%else
@@ -52,7 +50,6 @@
%prep
%setup -q
-%patch -p1
%build
%{?suse_update_config:%{suse_update_config -f}}
++++++ cifs-utils-4.3.tar.bz2 -> cifs-utils-4.4.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cifs-utils-4.3/Makefile.am new/cifs-utils-4.4/Makefile.am
--- old/cifs-utils-4.3/Makefile.am 2010-04-09 15:08:08.000000000 +0200
+++ new/cifs-utils-4.4/Makefile.am 2010-04-28 13:13:17.000000000 +0200
@@ -4,14 +4,14 @@
root_sbindir = "/sbin"
root_sbin_PROGRAMS = mount.cifs
mount_cifs_SOURCES = mount.cifs.c mtab.c util.c
-mount_cifs_LDADD = @LIBCAP@ @CAPNG_LDADD@
+mount_cifs_LDADD = $(LIBCAP) $(CAPNG_LDADD)
man_MANS = mount.cifs.8
if CONFIG_CIFSUPCALL
sbin_PROGRAMS = cifs.upcall
cifs_upcall_SOURCES = cifs.upcall.c data_blob.c asn1.c spnego.c util.c
-cifs_upcall_LDADD = -ltalloc -lkeyutils @KRB5_LDADD@
+cifs_upcall_LDADD = -ltalloc -lkeyutils $(KRB5_LDADD)
man_MANS += cifs.upcall.8
endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cifs-utils-4.3/Makefile.in new/cifs-utils-4.4/Makefile.in
--- old/cifs-utils-4.3/Makefile.in 2010-04-09 15:11:09.000000000 +0200
+++ new/cifs-utils-4.4/Makefile.in 2010-04-28 13:25:03.000000000 +0200
@@ -61,11 +61,13 @@
@CONFIG_CIFSUPCALL_TRUE@ data_blob.$(OBJEXT) asn1.$(OBJEXT) \
@CONFIG_CIFSUPCALL_TRUE@ spnego.$(OBJEXT) util.$(OBJEXT)
cifs_upcall_OBJECTS = $(am_cifs_upcall_OBJECTS)
-cifs_upcall_DEPENDENCIES =
+am__DEPENDENCIES_1 =
+@CONFIG_CIFSUPCALL_TRUE@cifs_upcall_DEPENDENCIES = \
+@CONFIG_CIFSUPCALL_TRUE@ $(am__DEPENDENCIES_1)
am_mount_cifs_OBJECTS = mount.cifs.$(OBJEXT) mtab.$(OBJEXT) \
util.$(OBJEXT)
mount_cifs_OBJECTS = $(am_mount_cifs_OBJECTS)
-mount_cifs_DEPENDENCIES =
+mount_cifs_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -205,10 +207,10 @@
ACLOCAL_AMFLAGS = -I aclocal
root_sbindir = "/sbin"
mount_cifs_SOURCES = mount.cifs.c mtab.c util.c
-mount_cifs_LDADD = @LIBCAP@ @CAPNG_LDADD@
+mount_cifs_LDADD = $(LIBCAP) $(CAPNG_LDADD)
man_MANS = mount.cifs.8 $(am__append_1)
@CONFIG_CIFSUPCALL_TRUE@cifs_upcall_SOURCES = cifs.upcall.c data_blob.c asn1.c spnego.c util.c
-@CONFIG_CIFSUPCALL_TRUE@cifs_upcall_LDADD = -ltalloc -lkeyutils @KRB5_LDADD@
+@CONFIG_CIFSUPCALL_TRUE@cifs_upcall_LDADD = -ltalloc -lkeyutils $(KRB5_LDADD)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cifs-utils-4.3/autom4te.cache/output.0 new/cifs-utils-4.4/autom4te.cache/output.0
--- old/cifs-utils-4.3/autom4te.cache/output.0 2010-04-09 15:11:06.000000000 +0200
+++ new/cifs-utils-4.4/autom4te.cache/output.0 2010-04-28 13:24:59.000000000 +0200
@@ -1,6 +1,6 @@
@%:@! /bin/sh
@%:@ Guess values for system-dependent variables and create Makefiles.
-@%:@ Generated by GNU Autoconf 2.63 for cifs-utils 4.3.
+@%:@ Generated by GNU Autoconf 2.63 for cifs-utils 4.3.1.
@%:@
@%:@ Report bugs to .
@%:@
@@ -596,8 +596,8 @@
# Identity of this package.
PACKAGE_NAME='cifs-utils'
PACKAGE_TARNAME='cifs-utils'
-PACKAGE_VERSION='4.3'
-PACKAGE_STRING='cifs-utils 4.3'
+PACKAGE_VERSION='4.3.1'
+PACKAGE_STRING='cifs-utils 4.3.1'
PACKAGE_BUGREPORT='cifs-utils@samba.org'
ac_unique_file="replace.h"
@@ -1294,7 +1294,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures cifs-utils 4.3 to adapt to many kinds of systems.
+\`configure' configures cifs-utils 4.3.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1360,7 +1360,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of cifs-utils 4.3:";;
+ short | recursive ) echo "Configuration of cifs-utils 4.3.1:";;
esac
cat <<\_ACEOF
@@ -1454,7 +1454,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-cifs-utils configure 4.3
+cifs-utils configure 4.3.1
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1468,7 +1468,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by cifs-utils $as_me 4.3, which was
+It was created by cifs-utils $as_me 4.3.1, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -2324,7 +2324,7 @@
# Define the identity of the package.
PACKAGE='cifs-utils'
- VERSION='4.3'
+ VERSION='4.3.1'
cat >>confdefs.h <<_ACEOF
@@ -8334,7 +8334,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by cifs-utils $as_me 4.3, which was
+This file was extended by cifs-utils $as_me 4.3.1, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8397,7 +8397,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-cifs-utils config.status 4.3
+cifs-utils config.status 4.3.1
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cifs-utils-4.3/autom4te.cache/output.1 new/cifs-utils-4.4/autom4te.cache/output.1
--- old/cifs-utils-4.3/autom4te.cache/output.1 2010-04-09 15:11:08.000000000 +0200
+++ new/cifs-utils-4.4/autom4te.cache/output.1 2010-04-28 13:25:02.000000000 +0200
@@ -1,6 +1,6 @@
@%:@! /bin/sh
@%:@ Guess values for system-dependent variables and create Makefiles.
-@%:@ Generated by GNU Autoconf 2.63 for cifs-utils 4.3.
+@%:@ Generated by GNU Autoconf 2.63 for cifs-utils 4.3.1.
@%:@
@%:@ Report bugs to .
@%:@
@@ -596,8 +596,8 @@
# Identity of this package.
PACKAGE_NAME='cifs-utils'
PACKAGE_TARNAME='cifs-utils'
-PACKAGE_VERSION='4.3'
-PACKAGE_STRING='cifs-utils 4.3'
+PACKAGE_VERSION='4.3.1'
+PACKAGE_STRING='cifs-utils 4.3.1'
PACKAGE_BUGREPORT='cifs-utils@samba.org'
ac_unique_file="replace.h"
@@ -1294,7 +1294,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures cifs-utils 4.3 to adapt to many kinds of systems.
+\`configure' configures cifs-utils 4.3.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1360,7 +1360,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of cifs-utils 4.3:";;
+ short | recursive ) echo "Configuration of cifs-utils 4.3.1:";;
esac
cat <<\_ACEOF
@@ -1454,7 +1454,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-cifs-utils configure 4.3
+cifs-utils configure 4.3.1
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1468,7 +1468,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by cifs-utils $as_me 4.3, which was
+It was created by cifs-utils $as_me 4.3.1, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -2324,7 +2324,7 @@
# Define the identity of the package.
PACKAGE='cifs-utils'
- VERSION='4.3'
+ VERSION='4.3.1'
cat >>confdefs.h <<_ACEOF
@@ -8334,7 +8334,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by cifs-utils $as_me 4.3, which was
+This file was extended by cifs-utils $as_me 4.3.1, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8397,7 +8397,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-cifs-utils config.status 4.3
+cifs-utils config.status 4.3.1
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cifs-utils-4.3/autom4te.cache/traces.1 new/cifs-utils-4.4/autom4te.cache/traces.1
--- old/cifs-utils-4.3/autom4te.cache/traces.1 2010-04-09 15:11:08.000000000 +0200
+++ new/cifs-utils-4.4/autom4te.cache/traces.1 2010-04-28 13:25:02.000000000 +0200
@@ -1,5 +1,5 @@
m4trace:aclocal.m4:993: -1- m4_include([aclocal/libcap.m4])
-m4trace:configure.ac:4: -1- AC_INIT([cifs-utils], [4.3], [cifs-utils@samba.org], [cifs-utils], [http://linux-cifs.samba.org/cifs-utils/])
+m4trace:configure.ac:4: -1- AC_INIT([cifs-utils], [4.3.1], [cifs-utils@samba.org], [cifs-utils], [http://linux-cifs.samba.org/cifs-utils/])
m4trace:configure.ac:4: -1- m4_pattern_forbid([^_?A[CHUM]_])
m4trace:configure.ac:4: -1- m4_pattern_forbid([_AC_])
m4trace:configure.ac:4: -1- m4_pattern_forbid([^LIBOBJS$], [do not use LIBOBJS directly, use AC_LIBOBJ (see section `AC_LIBOBJ vs LIBOBJS'])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cifs-utils-4.3/configure new/cifs-utils-4.4/configure
--- old/cifs-utils-4.3/configure 2010-04-09 15:11:07.000000000 +0200
+++ new/cifs-utils-4.4/configure 2010-04-28 13:25:01.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for cifs-utils 4.3.
+# Generated by GNU Autoconf 2.63 for cifs-utils 4.3.1.
#
# Report bugs to .
#
@@ -596,8 +596,8 @@
# Identity of this package.
PACKAGE_NAME='cifs-utils'
PACKAGE_TARNAME='cifs-utils'
-PACKAGE_VERSION='4.3'
-PACKAGE_STRING='cifs-utils 4.3'
+PACKAGE_VERSION='4.3.1'
+PACKAGE_STRING='cifs-utils 4.3.1'
PACKAGE_BUGREPORT='cifs-utils@samba.org'
ac_unique_file="replace.h"
@@ -1294,7 +1294,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures cifs-utils 4.3 to adapt to many kinds of systems.
+\`configure' configures cifs-utils 4.3.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1360,7 +1360,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of cifs-utils 4.3:";;
+ short | recursive ) echo "Configuration of cifs-utils 4.3.1:";;
esac
cat <<\_ACEOF
@@ -1454,7 +1454,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-cifs-utils configure 4.3
+cifs-utils configure 4.3.1
generated by GNU Autoconf 2.63
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1468,7 +1468,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by cifs-utils $as_me 4.3, which was
+It was created by cifs-utils $as_me 4.3.1, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ $0 $@
@@ -2324,7 +2324,7 @@
# Define the identity of the package.
PACKAGE='cifs-utils'
- VERSION='4.3'
+ VERSION='4.3.1'
cat >>confdefs.h <<_ACEOF
@@ -8334,7 +8334,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by cifs-utils $as_me 4.3, which was
+This file was extended by cifs-utils $as_me 4.3.1, which was
generated by GNU Autoconf 2.63. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -8397,7 +8397,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-cifs-utils config.status 4.3
+cifs-utils config.status 4.3.1
configured by $0, generated by GNU Autoconf 2.63,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cifs-utils-4.3/configure.ac new/cifs-utils-4.4/configure.ac
--- old/cifs-utils-4.3/configure.ac 2010-04-09 15:08:08.000000000 +0200
+++ new/cifs-utils-4.4/configure.ac 2010-04-28 13:13:17.000000000 +0200
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
-AC_INIT([cifs-utils], [4.3], [cifs-utils@samba.org], [cifs-utils], [http://linux-cifs.samba.org/cifs-utils/])
+AC_INIT([cifs-utils], [4.3.1], [cifs-utils@samba.org], [cifs-utils], [http://linux-cifs.samba.org/cifs-utils/])
AC_CONFIG_SRCDIR([replace.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cifs-utils-4.3/mount.cifs.c new/cifs-utils-4.4/mount.cifs.c
--- old/cifs-utils-4.3/mount.cifs.c 2010-04-09 15:08:08.000000000 +0200
+++ new/cifs-utils-4.4/mount.cifs.c 2010-04-28 13:13:17.000000000 +0200
@@ -98,7 +98,7 @@
#endif
#define MOUNT_PASSWD_SIZE 128
-#define DOMAIN_SIZE 64
+#define MAX_DOMAIN_SIZE 64
/*
* value of the ver= option that gets passed to the kernel. Used to indicate
@@ -121,6 +121,14 @@
*/
#define CIFS_SETUID_FLAGS (MS_NOSUID|MS_NODEV)
+/*
+ * Values for parsing a credentials file.
+ */
+#define CRED_UNPARSEABLE 0
+#define CRED_USER 1
+#define CRED_PASS 2
+#define CRED_DOM 4
+
/* struct for holding parsed mount info for use by privleged process */
struct parsed_mount_info {
unsigned long flags;
@@ -128,7 +136,7 @@
char share[MAX_SHARE_LEN + 1];
char prefix[PATH_MAX + 1];
char options[MAX_OPTIONS_LEN];
- char domain[DOMAIN_SIZE + 1];
+ char domain[MAX_DOMAIN_SIZE + 1];
char username[MAX_USERNAME_SIZE + 1];
char password[MOUNT_PASSWD_SIZE + 1];
char addrlist[MAX_ADDR_LIST_LEN];
@@ -300,9 +308,10 @@
/* everything after first % sign is a password */
password = strchr(rawuser, '%');
if (password) {
- rc = set_password(parsed_info, password);
+ rc = set_password(parsed_info, password + 1);
if (rc)
return rc;
+ *password = '\0';
}
/* everything after first '/' or '\' is a username */
@@ -511,120 +520,124 @@
#endif /* HAVE_LIBCAP */
#endif /* HAVE_LIBCAP_NG */
+static void null_terminate_endl(char *source)
+{
+ char *newline = strchr(source, '\n');
+ if (newline)
+ *newline = '\0';
+}
+
+/*
+ * Parse a line from the credentials file. Changes target to first
+ * character after '=' on 'line' and returns the value type of the line
+ * Returns CRED_UNPARSEABLE on failure or if either parameter is NULL.
+ */
+static int parse_cred_line(char *line, char **target)
+{
+ if (line == NULL || target == NULL)
+ goto parsing_err;
+
+ /* position target at first char of value */
+ *target = strchr(line, '=');
+ if (!*target)
+ goto parsing_err;
+ *target += 1;
+
+ /* tell the caller which value target points to */
+ if (strncasecmp("user", line, 4) == 0)
+ return CRED_USER;
+ if (strncasecmp("pass", line, 4) == 0)
+ return CRED_PASS;
+ if (strncasecmp("dom", line, 3) == 0)
+ return CRED_DOM;
+
+parsing_err:
+ return CRED_UNPARSEABLE;
+}
+
static int open_cred_file(char *file_name,
- struct parsed_mount_info *parsed_info)
+ struct parsed_mount_info *parsed_info)
{
char *line_buf;
- char *temp_val, *newline;
+ char *temp_val;
FILE *fs = NULL;
- int i, length;
+ int i;
+ const int line_buf_size = 4096;
+ const int min_non_white = 10;
i = toggle_dac_capability(0, 1);
if (i)
- return i;
+ goto return_i;
i = access(file_name, R_OK);
if (i) {
toggle_dac_capability(0, 0);
- return i;
+ goto return_i;
}
fs = fopen(file_name, "r");
if (fs == NULL) {
toggle_dac_capability(0, 0);
- return errno;
+ i = errno;
+ goto return_i;
}
i = toggle_dac_capability(0, 0);
- if (i) {
- fclose(fs);
- return i;
- }
+ if (i)
+ goto return_i;
- line_buf = (char *)malloc(4096);
+ line_buf = (char *)malloc(line_buf_size);
if (line_buf == NULL) {
- fclose(fs);
- return EX_SYSERR;
+ i = EX_SYSERR;
+ goto return_i;
}
- while (fgets(line_buf, 4096, fs)) {
- /* parse line from credential file */
-
+ /* parse line from credentials file */
+ while (fgets(line_buf, line_buf_size, fs)) {
/* eat leading white space */
- for (i = 0; i < 4086; i++) {
+ for (i = 0; i < line_buf_size - min_non_white + 1; i++) {
if ((line_buf[i] != ' ') && (line_buf[i] != '\t'))
break;
- /* if whitespace - skip past it */
}
+ null_terminate_endl(line_buf);
- /* NULL terminate at newline */
- newline = strchr(line_buf + i, '\n');
- if (newline)
- *newline = '\0';
-
- if (strncasecmp("user", line_buf + i, 4) == 0) {
- temp_val = strchr(line_buf + i, '=');
- if (temp_val) {
- /* go past equals sign */
- temp_val++;
- for (length = 0; length < 4087; length++) {
- if ((temp_val[length] == '\n')
- || (temp_val[length] == '\0')) {
- temp_val[length] = '\0';
- break;
- }
- }
- if (length > 4086) {
- fprintf(stderr,
- "mount.cifs failed due to malformed username in credentials file\n");
- memset(line_buf, 0, 4096);
- return EX_USAGE;
- }
- parsed_info->got_user = 1;
- strlcpy(parsed_info->username, temp_val,
- sizeof(parsed_info->username));
- }
- } else if (strncasecmp("pass", line_buf + i, 4) == 0) {
- temp_val = strchr(line_buf + i, '=');
- if (!temp_val)
- continue;
- ++temp_val;
+ /* parse next token */
+ switch (parse_cred_line(line_buf + i, &temp_val)) {
+ case CRED_USER:
+ i = parse_username(temp_val, parsed_info);
+ if (i)
+ goto return_i;
+ break;
+ case CRED_PASS:
i = set_password(parsed_info, temp_val);
if (i)
- return i;
- } else if (strncasecmp("dom", line_buf + i, 3) == 0) {
- temp_val = strchr(line_buf + i, '=');
- if (temp_val) {
- /* go past equals sign */
- temp_val++;
- if (parsed_info->verboseflag)
- fprintf(stderr, "\nDomain %s\n",
- temp_val);
-
- for (length = 0; length < DOMAIN_SIZE + 1;
- length++) {
- if ((temp_val[length] == '\n')
- || (temp_val[length] == '\0')) {
- temp_val[length] = '\0';
- break;
- }
- }
-
- if (length > DOMAIN_SIZE) {
- fprintf(stderr,
- "mount.cifs failed: domain in credentials file too long\n");
- return EX_USAGE;
- }
-
- strlcpy(parsed_info->domain, temp_val,
- sizeof(parsed_info->domain));
- }
+ goto return_i;
+ break;
+ case CRED_DOM:
+ if (parsed_info->verboseflag)
+ fprintf(stderr, "domain=%s\n",
+ temp_val);
+ strlcpy(parsed_info->domain, temp_val,
+ sizeof(parsed_info->domain));
+ break;
+ case CRED_UNPARSEABLE:
+ if (parsed_info->verboseflag)
+ fprintf(stderr,
+ "Credential formatted incorrectly: %s",
+ temp_val);
+ break;
}
-
}
- fclose(fs);
+ i = 0;
+return_i:
+ if (fs != NULL)
+ fclose(fs);
+
+ /* make sure passwords are scrubbed from memory */
+ if (line_buf != NULL)
+ memset(line_buf, 0, line_buf_size);
SAFE_FREE(line_buf);
- return 0;
+ return i;
}
static int
@@ -1596,6 +1609,9 @@
mountpoint = argv[optind + 1];
/* chdir into mountpoint as soon as possible */
+ rc = toggle_dac_capability(0, 1);
+ if (rc)
+ return rc;
rc = chdir(mountpoint);
if (rc) {
fprintf(stderr, "Couldn't chdir to %s: %s\n", mountpoint,
@@ -1611,6 +1627,9 @@
rc = EX_SYSERR;
goto mount_exit;
}
+ rc = toggle_dac_capability(0, 0);
+ if (rc)
+ return rc;
/*
* mount.cifs does privilege separation. Most of the code to handle
@@ -1697,7 +1716,7 @@
}
if (parsed_info->verboseflag)
- fprintf(stderr, "mount.cifs kernel mount options: %s\n",
+ fprintf(stderr, "mount.cifs kernel mount options: %s",
options);
if (parsed_info->got_password) {
@@ -1724,9 +1743,11 @@
case ECONNREFUSED:
case EHOSTUNREACH:
currentaddress = nextaddress;
- nextaddress = strchr(currentaddress, ',');
- if (nextaddress)
- *nextaddress++ = '\0';
+ if (currentaddress) {
+ nextaddress = strchr(currentaddress, ',');
+ if (nextaddress)
+ *nextaddress++ = '\0';
+ }
goto mount_retry;
case ENODEV:
fprintf(stderr,
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org