summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2003-05-21 23:55:58 +0000
committerTom Yu <tlyu@mit.edu>2003-05-21 23:55:58 +0000
commit7460d7fdc679b019fabd12d1f90a9a7661ce73c6 (patch)
tree68a19daa97cb4966028844bb761bc05581c3dcc1 /src/lib
parenta9ee9b5ed1c1f2aa756f83e7b9ac255c1bc0fe95 (diff)
Set length correctly in krb5_get_in_tkt_with_password if password is
actually passed in. Also, fix test suite to be more lenient about password prompts, which changed under the previous patches for this ticket. ticket: 1480 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15463 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/kadm5/unit-test/ChangeLog8
-rw-r--r--src/lib/kadm5/unit-test/api.0/init.exp4
-rw-r--r--src/lib/kadm5/unit-test/api.2/init.exp4
-rw-r--r--src/lib/krb5/krb/ChangeLog5
-rw-r--r--src/lib/krb5/krb/gic_pwd.c10
5 files changed, 23 insertions, 8 deletions
diff --git a/src/lib/kadm5/unit-test/ChangeLog b/src/lib/kadm5/unit-test/ChangeLog
index f4da36de4..918f47d19 100644
--- a/src/lib/kadm5/unit-test/ChangeLog
+++ b/src/lib/kadm5/unit-test/ChangeLog
@@ -1,3 +1,11 @@
+2003-05-21 Tom Yu <tlyu@mit.edu>
+
+ * api.0/init.exp (test6, test7): Be slightly more lenient about
+ matching password prompt.
+
+ * api.2/init.exp (test6, test7): Be slightly more lenient about
+ matching password prompt.
+
2003-01-07 Ken Raeburn <raeburn@mit.edu>
* Makefile.ov: Deleted.
diff --git a/src/lib/kadm5/unit-test/api.0/init.exp b/src/lib/kadm5/unit-test/api.0/init.exp
index f232d23d0..d39ecce07 100644
--- a/src/lib/kadm5/unit-test/api.0/init.exp
+++ b/src/lib/kadm5/unit-test/api.0/init.exp
@@ -77,7 +77,7 @@ proc test6 {} {
send "ovsec_kadm_init admin null \$OVSEC_KADM_ADMIN_SERVICE null \$OVSEC_KADM_STRUCT_VERSION \$OVSEC_KADM_API_VERSION_1 server_handle\n"
expect {
- {Enter password:} { }
+ -re "assword\[^\r\n\]*: *" { }
eof {
fail "$test: eof instead of password prompt"
api_exit
@@ -103,7 +103,7 @@ proc test7 {} {
send "ovsec_kadm_init admin \"\" \$OVSEC_KADM_ADMIN_SERVICE null \$OVSEC_KADM_STRUCT_VERSION \$OVSEC_KADM_API_VERSION_1 server_handle\n"
expect {
- {Enter password:} { }
+ -re "assword\[^\r\n\]*: *" { }
-re "\n\[^\n\]+key:\[^\n\]*$" { }
eof {
fail "$test: eof instead of password prompt"
diff --git a/src/lib/kadm5/unit-test/api.2/init.exp b/src/lib/kadm5/unit-test/api.2/init.exp
index a1a2bc5ea..335f6e041 100644
--- a/src/lib/kadm5/unit-test/api.2/init.exp
+++ b/src/lib/kadm5/unit-test/api.2/init.exp
@@ -80,7 +80,7 @@ proc test6 {} {
send "kadm5_init admin null \$KADM5_ADMIN_SERVICE null \$KADM5_STRUCT_VERSION \$KADM5_API_VERSION_2 server_handle\n"
expect {
- {Enter password:} { }
+ -re "assword\[^\r\n\]*:" { }
eof {
fail "$test: eof instead of password prompt"
api_exit
@@ -106,7 +106,7 @@ proc test7 {} {
send "kadm5_init admin \"\" \$KADM5_ADMIN_SERVICE null \$KADM5_STRUCT_VERSION \$KADM5_API_VERSION_2 server_handle\n"
expect {
- {Enter password:} { }
+ -re "assword\[^\r\n\]*:" { }
-re "key:$" { }
eof {
fail "$test: eof instead of password prompt"
diff --git a/src/lib/krb5/krb/ChangeLog b/src/lib/krb5/krb/ChangeLog
index 4cfa1f5f7..0802d0e34 100644
--- a/src/lib/krb5/krb/ChangeLog
+++ b/src/lib/krb5/krb/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-21 Tom Yu <tlyu@mit.edu>
+
+ * gic_pwd.c (krb5_get_in_tkt_with_password): Set pw0.length
+ correctly if a password is passed in.
+
2003-05-20 Sam Hartman <hartmans@mit.edu>
* get_in_tkt.c: get_in_tkt only supports old (non-etype-info2)
diff --git a/src/lib/krb5/krb/gic_pwd.c b/src/lib/krb5/krb/gic_pwd.c
index 97db38e19..1d373f508 100644
--- a/src/lib/krb5/krb/gic_pwd.c
+++ b/src/lib/krb5/krb/gic_pwd.c
@@ -433,13 +433,15 @@ krb5_get_in_tkt_with_password(krb5_context context, krb5_flags options,
pw0array[0] = '\0';
pw0.data = pw0array;
if (password) {
- if (strlen(password) >= sizeof(pw0array))
+ pw0.length = strlen(password);
+ if (pw0.length > sizeof(pw0array))
return EINVAL;
strncpy(pw0.data, password, sizeof(pw0array));
- pw0array[strlen(password)] = '\0';
+ if (pw0.length == 0)
+ pw0.length = sizeof(pw0array);
+ } else {
+ pw0.length = sizeof(pw0array);
}
- pw0.length = sizeof(pw0array);
-
krb5int_populate_gic_opt(context, &opt,
options, addrs, ktypes,
pre_auth_types);