svn commit: samba r21736 - in branches/SAMBA_4_0:
source/auth/credentials source/lib/ldb/common testprogs/blackbox
abartlet at samba.org
abartlet at samba.org
Wed Mar 7 04:20:13 GMT 2007
Author: abartlet
Date: 2007-03-07 04:20:10 +0000 (Wed, 07 Mar 2007)
New Revision: 21736
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21736
Log:
Fix the smbclient test to do something more interesting with the last
few authentication tests. Now that the tests correctly 'fail', I was
able to fix the credentials subsystem to honour USER and PASSWD.
To get --machine-pass working, I needed ldb to always load it's static
modules, so I put this in ldb_connect().
Andrew Bartlett
Modified:
branches/SAMBA_4_0/source/auth/credentials/credentials.c
branches/SAMBA_4_0/source/auth/credentials/credentials.h
branches/SAMBA_4_0/source/auth/credentials/credentials_files.c
branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh
Changeset:
Modified: branches/SAMBA_4_0/source/auth/credentials/credentials.c
===================================================================
--- branches/SAMBA_4_0/source/auth/credentials/credentials.c 2007-03-07 03:10:30 UTC (rev 21735)
+++ branches/SAMBA_4_0/source/auth/credentials/credentials.c 2007-03-07 04:20:10 UTC (rev 21736)
@@ -648,8 +648,9 @@
cli_credentials_parse_password_fd(cred, atoi(getenv("PASSWD_FD")), CRED_GUESS_FILE);
}
- if (getenv("PASSWD_FILE")) {
- cli_credentials_parse_password_file(cred, getenv("PASSWD_FILE"), CRED_GUESS_FILE);
+ p = getenv("PASSWD_FILE");
+ if (p && p[0]) {
+ cli_credentials_parse_password_file(cred, p, CRED_GUESS_FILE);
}
if (cli_credentials_get_kerberos_state(cred) != CRED_DONT_USE_KERBEROS) {
Modified: branches/SAMBA_4_0/source/auth/credentials/credentials.h
===================================================================
--- branches/SAMBA_4_0/source/auth/credentials/credentials.h 2007-03-07 03:10:30 UTC (rev 21735)
+++ branches/SAMBA_4_0/source/auth/credentials/credentials.h 2007-03-07 04:20:10 UTC (rev 21736)
@@ -30,8 +30,8 @@
/* In order of priority */
enum credentials_obtained {
CRED_UNINITIALISED = 0, /* We don't even have a guess yet */
+ CRED_CALLBACK, /* Callback should be used to obtain value */
CRED_GUESS_ENV, /* Current value should be used, which was guessed */
- CRED_CALLBACK, /* Callback should be used to obtain value */
CRED_GUESS_FILE, /* A guess from a file (or file pointed at in env variable) */
CRED_CALLBACK_RESULT, /* Value was obtained from a callback */
CRED_SPECIFIED /* Was explicitly specified on the command-line */
Modified: branches/SAMBA_4_0/source/auth/credentials/credentials_files.c
===================================================================
--- branches/SAMBA_4_0/source/auth/credentials/credentials_files.c 2007-03-07 03:10:30 UTC (rev 21735)
+++ branches/SAMBA_4_0/source/auth/credentials/credentials_files.c 2007-03-07 04:20:10 UTC (rev 21736)
@@ -89,7 +89,7 @@
BOOL ret;
if (fd < 0) {
- fprintf(stderr, "Error opening PASSWD_FILE %s: %s\n",
+ fprintf(stderr, "Error opening password file %s: %s\n",
file, strerror(errno));
return False;
}
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2007-03-07 03:10:30 UTC (rev 21735)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c 2007-03-07 04:20:10 UTC (rev 21736)
@@ -232,6 +232,9 @@
{
int ret;
+ /* We seem to need to do this here, or else some utilities don't get ldb backends */
+ ldb_global_init();
+
ldb->flags = flags;
ret = ldb_connect_backend(ldb, url, options, &ldb->modules);
Modified: branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh
===================================================================
--- branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh 2007-03-07 03:10:30 UTC (rev 21735)
+++ branches/SAMBA_4_0/testprogs/blackbox/test_smbclient.sh 2007-03-07 04:20:10 UTC (rev 21736)
@@ -59,13 +59,10 @@
# compare locally
testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1`
# create directory
-echo mkdir bla | runcmd "Creating directory" || failed=`expr $failed + 1`
# cd to directory
-echo cd bla | runcmd "Changing directory" || failed=`expr $failed + 1`
# cd to top level directory
-echo cd .. | runcmd "Going back" || failed=`expr $failed + 1`
# remove directory
-echo rmdir bla | runcmd "Removing directory" || failed=`expr $failed + 1`
+echo "mkdir bla; cd bla; cd ..; rmdir bla" | runcmd "Creating directory, Changing directory, Going back, " || failed=`expr $failed + 1`
# enable recurse, create nested directory
echo "recurse; echo mkdir bla/bloe; exit" | runcmd "Creating nested directory" || failed=`expr $failed + 1`
# remove parent directory
@@ -97,17 +94,37 @@
echo ls | runcmd "List directory with LANMAN1" -m LANMAN1 || failed=`expr $failed + 1`
echo ls | runcmd "List directory with LANMAN2" -m LANMAN2 || failed=`expr $failed + 1`
-echo ls | testit "Test login with --machine-pass" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp --machine-pass
+echo ls | testit "Test login with --machine-pass" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp --machine-pass || failed=`expr $failed + 1`
-echo "password=$PASSWORD\nusername=$USERNAME\ndomain=$DOMAIN" > tmpauthfile
+(
+ echo "password=$PASSWORD"
+ echo "username=$USERNAME"
+ echo "domain=$DOMAIN"
+) > tmpauthfile
-echo ls | testit "Test login with --authentication-file" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp --authentication-file=tmpauthfile
+echo ls | testit "Test login with --authentication-file" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp --authentication-file=tmpauthfile || failed=`expr $failed + 1`
-echo "$PASSWORD" > tmppassfile
+PASSWD_FILE="tmppassfile"
+echo "$PASSWORD" > $PASSWD_FILE
+export PASSWD_FILE
+echo ls | testit "Test login with PASSWD_FILE" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=`expr $failed + 1`
+PASSWD_FILE=""
+export PASSWD_FILE
+unset PASSWD_FILE
-echo ls | PASSWD_FILE="tmppassfile" testit "Test login with PASSWD_FILE" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME"
+PASSWD="$PASSWORD"
+export PASSWD
+echo ls | testit "Test login with PASSWD" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=`expr $failed + 1`
+oldUSER=$USER
+USER="$USERNAME"
+export USER
+echo ls | testit "Test login with USER and PASSWD" $VALGRIND bin/smbclient $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" | failed=`expr $failed + 1`
+PASSWD=
+export PASSWD
+unset PASSWD
+USER=$oldUSER
+export USER
rm -f tmpfile tmpfile-old tmpfilex tmpauthfile tmppassfile
-
exit $failed
More information about the samba-cvs
mailing list