Example #1
0
int cgi_access_manager::write_full_access(const CString& Equiv, const CString& Password){
	if (!equiv_file.StrLength()) {
		current_cgi_access_manager = this;
		equiv_file = entry_manager::make_equiv_path("access.struct");
	}

#ifndef ANSI

	chmod(equiv_file.asString(), _S_IREAD | _S_IWRITE);

#endif

	int hfile2 = v_open(equiv_file.asString(), O_WRONLY | O_APPEND | O_CREAT, S_IRWXU);

	if (hfile2 == -1) {

		perror("<br>Error writing access.struct:");

		return 0;

	}
    CString EPassword(Password);    
    write(hfile2, Equiv.asString(), Equiv.StrLength());    
    write(hfile2, ",", strlen(","));

	CString EncryptedPassword(EPassword); EncryptedPassword.Encrypt();
    write(hfile2, EncryptedPassword.asString(), EncryptedPassword.StrLength());
    write(hfile2, "\n", strlen("\n"));  
    close(hfile2);
    return 1;      
}
Example #2
0
void cgi_access_manager::add_access(const CString& source, const CString& target){
	if ((!source.StrLength())||(source[0] == '#')) return;
	entry_manager::set_value(source, target);
}
Example #3
0
CString cgi_access_manager::get_value(cgiOutStream& CGIStream, const CString& name, int fatal){
	CString result = entry_manager::get_value(name);
	if ((!result.StrLength())&&fatal) cgi_error(CGIStream, "equivalence access denied");
	return result;
}
Example #4
0
void cgi_access_manager::check_access(cgiOutStream& CGIStream, const CString& pass, const CString& id){
	if (!pass.StrLength()) cgi_error(CGIStream, "access denied");
	if ((entry_manager::get_value(id)!=pass)&&(check_root_access(pass))) cgi_error(CGIStream, "access denied");
}