Author: rhafer Date: Tue Sep 2 15:29:34 2008 New Revision: 50577 URL: http://svn.opensuse.org/viewcvs/yast?rev=50577&view=rev Log: Warn about missing/invalid DNs Modified: trunk/ldap-server/src/LdapDatabase.ycp trunk/ldap-server/src/LdapServer.pm Modified: trunk/ldap-server/src/LdapDatabase.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapDatabase.ycp?rev=50577&r1=50576&r2=50577&view=diff ============================================================================== --- trunk/ldap-server/src/LdapDatabase.ycp (original) +++ trunk/ldap-server/src/LdapDatabase.ycp Tue Sep 2 15:29:34 2008 @@ -638,6 +638,19 @@ if ( type == `who_dn || type == `who_dn_subtree || type == `who_group ) { res["dn"] = UI::QueryWidget( `id( `te_who_dn), `Value ); + if ( res["dn"]:"" == "" ) + { + Popup::Error(_("Please enter a DN into the Textfield") ); + continue; + } + else + { + if ( ! LdapServer::ValidateDn( res["dn"]:"" ) ) + { + Popup::Error( "\"" + res["dn"]:"" + "\"" + _("is not a valid LDAP DN") ); + continue; + } + } } res["level"] = UI::QueryWidget( `id( `cb_access ), `Value ); @@ -835,6 +848,20 @@ map what = $[]; what["what"] = UI::QueryWidget( `id( `cb_what ), `Value ); what["dn"] = UI::QueryWidget( `id( `te_dn ), `Value ); + if ( (what["what"]:`nil == `dn_base || what["what"]:`nil == `dn_subtree ) && + what["dn"]:"" == "" ) + { + Popup::Error(_("Please enter a DN into the Textfield") ); + continue; + } + else + { + if ( ! LdapServer::ValidateDn( what["dn"]:"" ) ) + { + Popup::Error( "\"" + what["dn"]:"" + "\"" + _("is not a valid LDAP DN") ); + continue; + } + } what["attrs"] = UI::QueryWidget( `id( `te_attrs ), `Value ); what["filter"] = UI::QueryWidget( `id( `te_filter ), `Value ); Modified: trunk/ldap-server/src/LdapServer.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/ldap-server/src/LdapServer.pm?rev=50577&r1=50576&r2=50577&view=diff ============================================================================== --- trunk/ldap-server/src/LdapServer.pm (original) +++ trunk/ldap-server/src/LdapServer.pm Tue Sep 2 15:29:34 2008 @@ -1292,6 +1292,17 @@ return $rc; } +BEGIN { $TYPEINFO {ValidateDn} = ["function", "boolean", "string" ]; } +sub ValidateDn +{ + my ($self, $dn ) = @_; + if ( ! defined X500::DN->ParseRFC2253($dn) ) + { + return 0; + } + return 1; +} + sub IsSubordinate { my ($self, $base, $child) = @_; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org