Index: openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl,v diff -u -N -r1.87.4.2 -r1.87.4.3 --- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 5 Sep 2013 11:50:59 -0000 1.87.4.2 +++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 30 Sep 2013 18:26:48 -0000 1.87.4.3 @@ -260,7 +260,7 @@ bad_password - auth_error - failed_to_connect { - if { ![exists_and_not_null result(auth_message)] } { + if { ![info exists result(auth_message)] || $result(auth_message) eq "" } { array set default_auth_message { no_account {Unknown username} bad_password {Bad password} @@ -289,7 +289,7 @@ } } closed { - if { ![exists_and_not_null result(account_message)] } { + if { ![info exists result(account_message)] || $result(account_message) eq "" } { set result(account_message) [_ acs-subsite.Account_not_avail_now] } } @@ -333,7 +333,7 @@ } } closed { - if { ![exists_and_not_null result(account_message)] } { + if { ![info exists result(account_message)] || $result(account_message) eq "" } { set result(account_message) [_ acs-subsite.Account_not_avail_now] } } @@ -350,8 +350,8 @@ set result(account_status) closed } - if { [exists_and_not_null remote_account_message] } { - if { [exists_and_not_null result(account_message)] } { + if { $remote_account_message ne "" } { + if { [info exists result(account_message)] && $result(account_message) ne "" } { # Concatenate local and remote account messages set result(account_message) "
[auth::authority::get_element -authority_id $authority_id -element pretty_name]: $remote_account_message
[ad_system_name]: $result(account_message)
" } else { @@ -360,7 +360,7 @@ } # Issue login cookie if login was successful - if { $result(auth_status) eq "ok" && !$no_cookie_p && [exists_and_not_null result(user_id)] } { + if { $result(auth_status) eq "ok" && !$no_cookie_p && [info exists result(user_id)] && $result(user_id) ne "" } { auth::issue_login \ -user_id $result(user_id) \ -persistent=$persistent_p \ @@ -565,7 +565,7 @@ data_error - reg_error - failed_to_connect { - if { ![exists_and_not_null creation_info(creation_message)] } { + if { $creation_info(creation_message) eq "" } { set creation_info(creation_message) $default_creation_message($creation_info(creation_status)) } if { ![info exists creation_info(element_messages)] } { @@ -587,7 +587,7 @@ set creation_info(account_message) {} } closed { - if { ![exists_and_not_null creation_info(account_message)] } { + if { $creation_info(account_message) eq "" } { set creation_info(account_message) [_ acs-subsite.Account_not_avail_now] } } @@ -601,8 +601,7 @@ } on_error { set creation_info(creation_status) failed_to_connect set creation_info(creation_message) $errmsg - global errorInfo - ns_log Error "auth::create_user: Error invoking account registration driver for authority_id = $authority_id: $errorInfo" + ns_log Error "auth::create_user: Error invoking account registration driver for authority_id = $authority_id: $::errorInfo" } if { $creation_info(creation_status) ne "ok" } { @@ -620,8 +619,8 @@ set creation_info(account_status) closed } - if { [exists_and_not_null local_account_message] } { - if { [exists_and_not_null creation_info(account_message)] } { + if { ([info exists local_account_message] && $local_account_message ne "") } { + if { ([info exists creation_info(account_message)] && $creation_info(account_message) ne "") } { # Concatenate local and remote account messages set creation_info(account_message) "[auth::authority::get_element -authority_id $authority_id -element pretty_name]: $creation_info(account_message)
[ad_system_name]: $local_account_message
" } else { @@ -888,7 +887,7 @@ set member_state "approved" } - if { ![exists_and_not_null user_info(email_verified_p)] } { + if { ![info exists user_info(email_verified_p)] || $user_info(email_verified_p) eq "" } { if { [parameter::get -parameter RegistrationRequiresEmailVerificationP -default 0] } { set user_info(email_verified_p) "f" } else { @@ -964,8 +963,7 @@ if { $error_p || $user_id == 0 } { set result(creation_status) "failed_to_connect" set result(creation_message) [_ acs-subsite.Error_trying_to_register] - global errorInfo - ns_log Error "auth::create_local_account: Error creating local account.\n$errorInfo" + ns_log Error "auth::create_local_account: Error creating local account.\n$::errorInfo" return [array get result] } @@ -987,8 +985,7 @@ with_catch errmsg { auth::send_email_verification_email -user_id $user_id } { - global errorInfo - ns_log Error "auth::create_local_account: Error sending out email verification email to email $email:\n$errorInfo" + ns_log Error "auth::create_local_account: Error sending out email verification email to email $email:\n$::errorInfo" set auth_info(account_message) [_ acs_subsite.Error_sending_verification_mail] } } @@ -1324,16 +1321,19 @@ array set user $info_result(user_info) - if {$email ne "" \ - && (![info exists user(email)] || $user(email) eq "")} { + if {$email ne "" + && (![info exists user(email)] || $user(email) eq "") + } { set user(email) $email } - if {$first_names ne "" \ - && (![info exists user(first_names)] || $user(first_names) eq "")} { + if {$first_names ne "" + && (![info exists user(first_names)] || $user(first_names) eq "") + } { set user(first_names) $first_names } - if {$last_name ne "" \ - && (![info exists user(last_name)] || $user(last_name) eq "")} { + if {$last_name ne "" + && (![info exists user(last_name)] || $user(last_name) eq "") + } { set user(last_name) $last_name } array set creation_info [auth::create_local_account \ @@ -1542,7 +1542,7 @@ } foreach elm $required_elms { - if { ![exists_and_not_null user($elm)] } { + if { ![info exists user($elm)] || $user($elm) eq "" } { set element_messages($elm) "Required" } } @@ -1570,15 +1570,17 @@ } # TODO: When doing RBM's parameter, make sure that we still require both first_names and last_names, or none of them - if { [exists_and_not_null user(first_names)] && [string first "<" $user(first_names)] != -1 } { + if { ([info exists user(first_names)] && $user(first_names) ne "") + && [string first "<" $user(first_names)] != -1 } { set element_messages(first_names) [_ acs-subsite.lt_You_cant_have_a_lt_in] } - if { [exists_and_not_null user(last_name)] && [string first "<" $user(last_name)] != -1 } { + if { ([info exists user(last_name)] && $user(last_name) ne "") + && [string first "<" $user(last_name)] != -1 } { set element_messages(last_name) [_ acs-subsite.lt_You_cant_have_a_lt_in_1] } - if { [exists_and_not_null user(email)] } { + if { [info exists user(email)] && $user(email) ne "" } { if { ![util_email_valid_p $user(email)] } { set element_messages(email) [_ acs-subsite.Not_valid_email_addr] } else { @@ -1605,7 +1607,7 @@ } } - if { [exists_and_not_null user(email)] } { + if { ([info exists user(email)] && $user(email) ne "") } { # Check that email is unique set email $user(email) set email_party_id [party::get_by_email -email $user(email)] @@ -1638,12 +1640,15 @@ } # They're trying to set the username - if { [exists_and_not_null user(username)] } { + if { [info exists user(username)] && $user(username) ne "" } { # Check that username is unique set username_user_id [acs_user::get_by_username -authority_id $authority_id -username $user(username)] - if { $username_user_id ne "" && (!$update_p || $username_user_id != $user(user_id)) } { - # We already have a user with this username, and either we're not updating, or it's not the same user_id as the one we're updating + if { $username_user_id ne "" + && (!$update_p || $username_user_id != $user(user_id)) } { + # We already have a user with this username, and either + # we're not updating, or it's not the same user_id as the + # one we're updating set username_member_state [acs_user::get_element -user_id $username_user_id -element member_state] switch $username_member_state { Index: openacs-4/packages/acs-authentication/tcl/authority-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authority-procs.tcl,v diff -u -N -r1.28 -r1.28.8.1 --- openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 6 Apr 2009 20:13:15 -0000 1.28 +++ openacs-4/packages/acs-authentication/tcl/authority-procs.tcl 30 Sep 2013 18:26:48 -0000 1.28.8.1 @@ -104,15 +104,15 @@ } } - if { ![exists_and_not_null context_id] } { + if { ![info exists context_id] || $context_id eq "" } { set context_id [ad_conn package_id] } - if { ![exists_and_not_null creation_user] } { + if { ![info exists creation_user] || $creation_user eq "" } { set creation_user [ad_conn user_id] } - if { ![exists_and_not_null creation_ip] } { + if { ![info exists creation_ip] || $creation_ip eq "" } { set creation_ip [ad_conn peeraddr] } @@ -151,7 +151,7 @@ } # Flush the cache, so that if we've tried to request this short_name while it didn't exist, we will now find it - if { [exists_and_not_null row(short_name)] } { + if { [info exists row(short_name)] && $row(short_name) ne "" } { get_id_flush -short_name $row(short_name) } Index: openacs-4/packages/acs-authentication/tcl/local-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/local-procs.tcl,v diff -u -N -r1.37 -r1.37.6.1 --- openacs-4/packages/acs-authentication/tcl/local-procs.tcl 8 Oct 2009 14:33:46 -0000 1.37 +++ openacs-4/packages/acs-authentication/tcl/local-procs.tcl 30 Sep 2013 18:26:48 -0000 1.37.6.1 @@ -367,7 +367,7 @@ } # Reset the password - if {[exists_and_not_null new_password]} { + if { $new_password ne "" } { set password $new_password } else { set password [ad_generate_random_string] Index: openacs-4/packages/acs-authentication/tcl/password-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/password-procs.tcl,v diff -u -N -r1.18 -r1.18.6.1 --- openacs-4/packages/acs-authentication/tcl/password-procs.tcl 13 Jan 2010 10:53:00 -0000 1.18 +++ openacs-4/packages/acs-authentication/tcl/password-procs.tcl 30 Sep 2013 18:26:48 -0000 1.18.6.1 @@ -128,7 +128,7 @@ } } no_account - not_supported - old_password_bad - new_password_bad - change_error - failed_to_connect { - if { ![exists_and_not_null result(password_message)] } { + if { ![info exists result(password_message)] || $result(password_message) eq "" } { array set default_message { no_account {Unknown username} not_supported {This operation is not supported} @@ -344,7 +344,7 @@ # Check the result code and provide canned responses switch $result(password_status) { ok { - if { [exists_and_not_null result(password)] } { + if { [info exists result(password)] && $result(password) ne "" } { # We have retrieved or reset a forgotten password that we should email to the user with_catch errmsg { auth::password::email_password \ @@ -361,12 +361,12 @@ ns_log Error "We had an error sending out email with new password to username $username, authority $authority_id:\n$errorInfo" } } - if { ![exists_and_not_null result(password_message)] } { + if { ![info exists result(password_message)] || $result(password_message) eq "" } { set result(password_message) [_ acs-subsite.Check_Your_Inbox] } } no_account - not_supported - retrieve_error - failed_to_connect { - if { ![exists_and_not_null result(password_message)] } { + if { ![info exists result(password_message)] || $result(password_message) eq "" } { array set default_message { no_account {Unknown username} not_supported {This operation is not supported} @@ -449,14 +449,13 @@ } { set result(password_status) failed_to_connect set result(password_message) "Error invoking the password management driver." - global errorInfo - ns_log Error "Error invoking password management driver for authority_id = $authority_id: $errorInfo" + ns_log Error "Error invoking password management driver for authority_id = $authority_id: $::errorInfo" } # Check the result code and provide canned responses switch $result(password_status) { ok { - if { [exists_and_not_null result(password)] && \ + if { ([info exists result(password)] && $result(password) ne "") && \ (!$admin_p || [parameter::get \ -parameter EmailChangedPasswordP \ -package_id [ad_conn subsite_id] \ @@ -477,12 +476,12 @@ ns_log Error "We had an error sending out email with new password to username $username, authority $authority_id:\n$errorInfo" } } - if { ![exists_and_not_null result(password_message)] } { + if { ![info exists result(password_message)] || $result(password_message) eq "" } { set result(password_message) [_ acs-subsite.Check_Your_Inbox] } } no_account - not_supported - retrieve_error - failed_to_connect { - if { ![exists_and_not_null result(password_message)] } { + if { (![info exists result(password_message)] || $result(password_message) eq "") } { array set default_message { no_account {Unknown username} not_supported {This operation is not supported} Index: openacs-4/packages/acs-authentication/tcl/sync-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/sync-procs.tcl,v diff -u -N -r1.34.6.1 -r1.34.6.2 --- openacs-4/packages/acs-authentication/tcl/sync-procs.tcl 25 Aug 2013 20:00:12 -0000 1.34.6.1 +++ openacs-4/packages/acs-authentication/tcl/sync-procs.tcl 30 Sep 2013 18:26:48 -0000 1.34.6.2 @@ -511,7 +511,7 @@ } { Purge jobs that are older than KeepBatchLogDays days. } { - if { ![exists_and_not_null num_days] } { + if { $num_days eq "" } { set num_days [parameter::get_from_package_key \ -parameter KeepBatchLogDays \ -package_key "acs-authentication" \ Index: openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl,v diff -u -N -r1.42 -r1.42.8.1 --- openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 10 Feb 2009 18:27:08 -0000 1.42 +++ openacs-4/packages/acs-authentication/tcl/test/acs-authentication-procs.tcl 30 Sep 2013 18:26:48 -0000 1.42.8.1 @@ -167,7 +167,8 @@ } } - aa_false "No creation_message for successful creation" [exists_and_not_null user_info(creation_message)] + aa_false "No creation_message for successful creation" \ + [expr {[info exists user_info(creation_message)] && $user_info(creation_message) ne ""}] aa_true "returns user_id" [info exists user_info(user_id)] if { [info exists user_info(user_id)] } { @@ -187,12 +188,14 @@ aa_equals "creation_status for duplicate email and username" $user_info(creation_status) "data_error" - aa_true "element_messages exists" [exists_and_not_null user_info(element_messages)] - if { [exists_and_not_null user_info(element_messages)] } { + aa_true "element_messages exists" [info exists user_info(element_messages)] + if { [info exists user_info(element_messages)] && $user_info(element_messages) ne "" } { array unset elm_msgs array set elm_msgs $user_info(element_messages) - aa_true "element_message for username exists" [exists_and_not_null elm_msgs(username)] - aa_true "element_message for email exists" [exists_and_not_null elm_msgs(email)] + aa_true "element_message for username exists" \ + [expr {[info exists elm_msgs(username)] && $elm_msgs(username) ne ""}] + aa_true "element_message for email exists" \ + [expr {[info exists elm_msgs(email)] && $elm_msgs(email) ne ""}] } set user_id [acs_user::get_by_username -username auth_create_user1] if { $user_id ne "" } { @@ -212,18 +215,19 @@ aa_equals "creation_status is data_error" $user_info(creation_status) "data_error" - aa_true "element_messages exists" [exists_and_not_null user_info(element_messages)] - if { [exists_and_not_null user_info(element_messages)] } { + aa_true "element_messages exists" [info exists user_info(element_messages)] + if { [info exists user_info(element_messages)] && $user_info(element_messages) ne "" } { array unset elm_msgs array set elm_msgs $user_info(element_messages) - if { [aa_true "element_message(email) exists" [exists_and_not_null elm_msgs(email)]] } { + if { [aa_true "element_message(email) exists" \ + [expr {[info exists elm_msgs(email)] && $elm_msgs(email) ne ""}] aa_log "element_message(email) = $elm_msgs(email)" } - if { [aa_true "element_message(first_names) exists" [exists_and_not_null elm_msgs(first_names)]] } { + if { [aa_true "element_message(first_names) exists" [info exists elm_msgs(first_names)] aa_log "element_message(first_names) = $elm_msgs(first_names)" } - if { [aa_true "element_message(last_name) exists" [exists_and_not_null elm_msgs(last_name)]] } { + if { [aa_true "element_message(last_name) exists" [info exists elm_msgs(last_name)] aa_log "element_message(last_name) = $elm_msgs(last_name)" } } @@ -245,18 +249,18 @@ aa_equals "creation_status is data_error" $user_info(creation_status) "data_error" - aa_true "element_messages exists" [exists_and_not_null user_info(element_messages)] - if { [exists_and_not_null user_info(element_messages)] } { + aa_true "element_messages exists" [info exists user_info(element_messages)] + if { [info exists user_info(element_messages)] && $user_info(element_messages) ne "" } { array unset elm_msgs array set elm_msgs $user_info(element_messages) - if { [aa_true "element_message(email) exists" [exists_and_not_null elm_msgs(email)]] } { + if { [aa_true "element_message(email) exists" [info exists elm_msgs(email)]] } { aa_log "element_message(email) = $elm_msgs(email)" } - if { [aa_true "element_message(first_names) exists" [exists_and_not_null elm_msgs(first_names)]] } { + if { [aa_true "element_message(first_names) exists" [info exists elm_msgs(first_names)]] } { aa_log "element_message(first_names) = $elm_msgs(first_names)" } - if { [aa_true "element_message(last_name) exists" [exists_and_not_null elm_msgs(last_name)]] } { + if { [aa_true "element_message(last_name) exists" [info exists elm_msgs(last_name)]] } { aa_log "element_message(last_name) = $elm_msgs(last_name)" } } Index: openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl,v diff -u -N -r1.19 -r1.19.10.1 --- openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl 10 Jan 2007 21:22:01 -0000 1.19 +++ openacs-4/packages/acs-authentication/tcl/test/sync-test-procs.tcl 30 Sep 2013 18:26:48 -0000 1.19.10.1 @@ -18,7 +18,7 @@ set job_id [auth::sync::job::start \ -authority_id [auth::authority::local]] - aa_true "Returns a job_id" [exists_and_not_null job_id] + aa_true "Returns a job_id" [expr {$job_id ne ""}] # Get doc @@ -92,7 +92,7 @@ set job_id [auth::sync::job::start \ -authority_id [auth::authority::local]] - aa_true "Returns a job_id" [exists_and_not_null job_id] + aa_true "Returns a job_id" [expr {[info exists job_id]}] ##### # @@ -128,7 +128,7 @@ aa_log "entry.message = '$entry(message)'" aa_log "entry.element_messages = '$entry(element_messages)'" - if { [aa_true "Entry has user_id set" [exists_and_not_null entry(user_id)]] } { + if { [aa_true "Entry has user_id set" [expr {$entry(user_id) ne ""}]] } { array unset user acs_user::get -user_id $entry(user_id) -array user @@ -166,7 +166,7 @@ aa_equals "entry.success_p" $entry(success_p) "f" - aa_true "entry.message not empty" [exists_and_not_null entry(message)] + aa_true "entry.message not empty" [expr {$entry(message) ne ""}] aa_log "entry.user_id = '$entry(user_id)'" aa_log "entry.message = '$entry(message)'" @@ -203,7 +203,7 @@ aa_log "entry.message = '$entry(message)'" aa_log "entry.element_messages = '$entry(element_messages)'" - if { [aa_true "Entry has user_id set" [exists_and_not_null entry(user_id)]] } { + if { [aa_true "Entry has user_id set" [expr {$entry(user_id) ne ""}]] } { array unset user acs_user::get -user_id $entry(user_id) -array user @@ -243,7 +243,7 @@ aa_log "entry.message = '$entry(message)'" aa_log "entry.element_messages = '$entry(element_messages)'" - if { [aa_true "Entry has user_id set" [exists_and_not_null entry(user_id)]] } { + if { [aa_true "Entry has user_id set" [expr {$entry(user_id) ne ""}]] } { array unset user acs_user::get -user_id $entry(user_id) -array user @@ -280,7 +280,8 @@ aa_equals "entry.success_p" $entry(success_p) "f" aa_log "entry.message = '$entry(message)'" - if { [aa_true "entry.element_messages not empty" [exists_and_not_null entry(element_messages)]] } { + if { [aa_true "entry.element_messages not empty" \ + [expr {[info exists entry(element_messages)] && $entry(element_messages) ne ""}]] } { aa_log "entry.element_messages = '$entry(element_messages)'" array unset elm_msgs array set elm_msgs $entry(element_messages) @@ -308,7 +309,7 @@ aa_equals "entry.success_p" $entry(success_p) "t" aa_log "entry.message = '$entry(message)'" - if { [aa_true "Entry has user_id set" [exists_and_not_null entry(user_id)]] } { + if { [aa_true "Entry has user_id set" [expr {[info exists entry(user_id)] && $entry(user_id) ne ""}]] } { array unset user acs_user::get -user_id $entry(user_id) -array user aa_equals "User member state is banned" $user(member_state) "banned" @@ -348,7 +349,7 @@ set job_id [auth::sync::job::start \ -authority_id [auth::authority::local]] - aa_true "Returns a job_id" [exists_and_not_null job_id] + aa_true "Returns a job_id" [expr {$job_id ne ""}] ##### # @@ -383,7 +384,7 @@ aa_log "entry.message = '$entry(message)'" aa_log "entry.element_messages = '$entry(element_messages)'" - if { [aa_true "Entry has user_id set" [exists_and_not_null entry(user_id)]] } { + if { [aa_true "Entry has user_id set" [expr {$entry(user_id) ne ""}]] } { array unset user acs_user::get -user_id $entry(user_id) -array user @@ -426,7 +427,7 @@ aa_log "entry.message = '$entry(message)'" aa_log "entry.element_messages = '$entry(element_messages)'" - if { [aa_true "Entry has user_id set" [exists_and_not_null entry(user_id)]] } { + if { [aa_true "Entry has user_id set" [expr {$entry(user_id) ne ""}]] } { array unset user acs_user::get -user_id $entry(user_id) -array user @@ -491,7 +492,7 @@ auth::sync::job::get -job_id $job_id -array job aa_log "job.message = '$job(message)'" - aa_true "job.message not empty when called for local authority" [exists_and_not_null job(message)] + aa_true "job.message not empty when called for local authority" [expr {$job(message) ne ""}] } }