enabled = $enabled; $this->lib_ug = $lib_ug; $this->lib_ag = $lib_ag; $this->principal = $principal; $this->credential = $credential; $this->repository_uri = $repository_uri; $this->user_dn = $user_dn; $this->group_dn = $group_dn; $this->domain = $domain; } }; class CKRB5_info { var $enabled; var $realm; var $kdc; var $mappings; var $kt; function CKRB5_info( $enabled, $realm, $kdc, $mappings, $kt ) { $this->enabled = $enabled; $this->realm = $realm; $this->kdc = $kdc; $this->mappings = $mappings; $this->kt = $kt; } }; // Handel the progress screen if opened and get the NEW data if ($_SERVER[REQUEST_METHOD] == "POST") { $operationInProgress = true; $testResult = true; $status = new ReturnStatus(); // This contains sensitive information, and should not be in shipped code. //error_log("_POST = ". print_r($_POST,true) ); error_log("_FILES = ". print_r($_FILES,true) ); if( $_POST['test_ldap'] == "1" ) { test_ldap($user, $_POST['test_user'], $_POST['test_password'] ); } else { $ldapEnabled = False; $krb5Enabled = False; $krb5_kt = ""; if ( $_POST['enabled'] == "ldap" ) { $ldapEnabled = True; } else if ( $_POST['enabled'] == "krb5" ) { $ldapEnabled = True; $krb5Enabled = True; if(is_uploaded_file($_FILES['serviceKeytab']['tmp_name'])) { $krb5_kt = $_FILES['serviceKeytab']['tmp_name']; } else { $kt_exists = $_POST['krb5_kt_exists']; if (is_null($_FILES['serviceKeytab']) ) { error_log("The file is too big, brickUpdate is NULL"); $status->setErrorCode("4109"); } else { switch ($HTTP_POST_FILES['serviceKeytab']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form error_log("The file you are trying to upload is too big."); $status->setErrorCode("4109"); break; case 3: //uploaded file was only partially uploaded error_log("The file you are trying upload was only partially uploaded."); $status->setErrorCode("4110"); break; case 4: //no file was uploaded if ( ! $kt_exists ) { error_log("You must upload a keytab for the library principal."); $status->setErrorCode("4111"); } break; default: error_log("There was a problem with your upload."); $status->setErrorCode("4108"); break; } } } } $ldap_info = new CLDAP_info( $ldapEnabled, $_POST['lib_ug'], $_POST['lib_ag'], $_POST['principal'], $_POST['credential'], $_POST['repository_uri'], $_POST['user_dn'], $_POST['group_dn'], $_POST['domain'] ); $krb5_info = new CKRB5_info( $krb5Enabled, $_POST['krb5_realm'], $_POST['krb5_kdc'], $_POST['krb5_mappings'], $krb5_kt ); set_ldap($user, $ldap_info); set_krb5($user, $krb5_info); // Make sure the setting were valid. // $testResult = @test_ldap($user, $_POST['test_user'], $_POST['test_password']); // if( $testResult != 0 ) // { // $status->setErrorCode( 0x50022 ); // } } if( $_POST['enabled'] == "local" || $_POST['test_ldap'] == "1" ) print $status->out(); else { $text = "
Setup - Remote Authentication |
Authenticate logins against a third-party service. |