void CppiaVar::load(CppiaStream &stream) { readAccess = getAccess(stream); writeAccess = getAccess(stream); isVirtual = stream.getBool(); nameId = stream.getInt(); typeId = stream.getInt(); if (stream.getInt()) init = createCppiaExpr(stream); }
void Kaqtoos::setupConnections() { // OAUTH connect(oauthManager, SIGNAL(temporaryTokenReceived(QString,QString)), this, SLOT(onTemporaryTokenReceived(QString, QString))); connect(oauthManager, SIGNAL(authorizationReceived(QString,QString)), this, SLOT(onAuthorizationReceived(QString, QString))); connect(oauthManager, SIGNAL(accessTokenReceived(QString,QString)), this, SLOT(onAccessTokenReceived(QString,QString))); connect(oauthManager, SIGNAL(requestReady(QByteArray)), this, SLOT(onRequestReady(QByteArray))); // Network connect(&downloadManager, SIGNAL(getDownload(QBuffer *, const QString &)), this, SLOT(receiveBuffer(QBuffer *, const QString &))); // UI connect(connectAction, SIGNAL(triggered()), this, SLOT(getAccess())); connect(disconnectAction, SIGNAL(triggered()), this, SLOT(deleteUserOAuthConnection())); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(openAbout())); }
/******************************************************************************* ** ** Function bta_fs_co_access ** ** Description This function is called to check the existence of ** a file or directory, and return whether or not it is a ** directory or length of the file. ** ** Parameters p_path - (input) file or directory to access (fully qualified path). ** mode - (input) [BTA_FS_ACC_EXIST, BTA_FS_ACC_READ, or BTA_FS_ACC_RDWR] ** p_is_dir - (output) returns TRUE if p_path specifies a directory. ** app_id - (input) application ID specified in the enable functions. ** It can be used to identify which profile is the caller ** of the call-out function. ** ** Returns (tBTA_FS_CO_STATUS) status of the call. ** [BTA_FS_CO_OK if it exists] ** [BTA_FS_CO_EACCES if permissions are wrong] ** [BTA_FS_CO_FAIL if it does not exist] ** *******************************************************************************/ tBTA_FS_CO_STATUS bta_fs_co_access(const char *p_path, int mode, BOOLEAN *p_is_dir, UINT8 app_id) { int os_mode = 0; tBTA_FS_CO_STATUS status = BTA_FS_CO_OK; struct stat buffer; UNUSED(app_id); #if (TRUE==BTA_FS_DEBUG) LOGI("***********CHECKING ACCESS TO = %s", p_path); #endif #if (defined BTA_PBS_INCLUDED) && (BTA_PBS_INCLUDED == TRUE) if (app_id == UI_PBS_ID) { *p_is_dir = TRUE; #if (TRUE==BTA_FS_DEBUG) LOGI("***********SUPPORTED REPO = %d", bta_pbs_cfg.supported_repositories); #endif //Check if SIM contact requested, and if so if it's supported. //If not, return error! if (strstr(p_path,"SIM1") && !(bta_pbs_cfg.supported_repositories & 0x2)) { LOGI("***********RETURNING FAIL!"); return BTA_FS_CO_FAIL; } #if (TRUE==BTA_FS_DEBUG) LOGI("***********RETURNING success!"); #endif return (status); } #endif *p_is_dir = FALSE; if (mode == BTA_FS_ACC_RDWR) os_mode = 6; else if (mode == BTA_FS_ACC_READ) os_mode = 4; if (stat(p_path, &buffer) == 0) { /* Determine if the object is a file or directory */ if (S_ISDIR(buffer.st_mode)) *p_is_dir = TRUE; } else { BTIF_TRACE_DEBUG("stat() failed! "); return BTA_FS_CO_FAIL; } status=getAccess (os_mode, &buffer, (char*)p_path); return (status); }
/**************************************** * Return Prot access for Dsymbol smember in this declaration. */ Prot getAccess(AggregateDeclaration *ad, Dsymbol *smember) { Prot access_ret = Prot(PROTnone); #if LOG printf("+AggregateDeclaration::getAccess(this = '%s', smember = '%s')\n", ad->toChars(), smember->toChars()); #endif assert(ad->isStructDeclaration() || ad->isClassDeclaration()); if (smember->toParent() == ad) { access_ret = smember->prot(); } else if (smember->isDeclaration()->isStatic()) { access_ret = smember->prot(); } if (ClassDeclaration *cd = ad->isClassDeclaration()) { for (size_t i = 0; i < cd->baseclasses->dim; i++) { BaseClass *b = (*cd->baseclasses)[i]; Prot access = getAccess(b->base, smember); switch (access.kind) { case PROTnone: break; case PROTprivate: access_ret = Prot(PROTnone); // private members of base class not accessible break; case PROTpackage: case PROTprotected: case PROTpublic: case PROTexport: // If access is to be tightened if (b->protection.isMoreRestrictiveThan(access)) access = b->protection; // Pick path with loosest access if (access_ret.isMoreRestrictiveThan(access)) access_ret = access; break; default: assert(0); } } } #if LOG printf("-AggregateDeclaration::getAccess(this = '%s', smember = '%s') = %d\n", ad->toChars(), smember->toChars(), access_ret); #endif return access_ret; }
/******************************************************** * Helper function for checkAccess() * Returns: * false is not accessible * true is accessible */ static bool isAccessible( Dsymbol *smember, Dsymbol *sfunc, AggregateDeclaration *dthis, AggregateDeclaration *cdscope) { assert(dthis); #if 0 printf("isAccessible for %s.%s in function %s() in scope %s\n", dthis->toChars(), smember->toChars(), sfunc ? sfunc->toChars() : "NULL", cdscope ? cdscope->toChars() : "NULL"); #endif if (hasPrivateAccess(dthis, sfunc) || isFriendOf(dthis, cdscope)) { if (smember->toParent() == dthis) return true; if (ClassDeclaration *cdthis = dthis->isClassDeclaration()) { for (size_t i = 0; i < cdthis->baseclasses->dim; i++) { BaseClass *b = (*cdthis->baseclasses)[i]; Prot access = getAccess(b->base, smember); if (access.kind >= PROTprotected || isAccessible(smember, sfunc, b->base, cdscope)) { return true; } } } } else { if (smember->toParent() != dthis) { if (ClassDeclaration *cdthis = dthis->isClassDeclaration()) { for (size_t i = 0; i < cdthis->baseclasses->dim; i++) { BaseClass *b = (*cdthis->baseclasses)[i]; if (isAccessible(smember, sfunc, b->base, cdscope)) return true; } } } } return false; }
/******************************************************************************* ** ** Function bta_fs_co_unlink ** ** Description This function is called to remove a file whose name ** is given by p_path. ** ** Parameters p_path - (input) name of file to remove (fully qualified path). ** app_id - (input) application ID specified in the enable functions. ** It can be used to identify which profile is the caller ** of the call-out function. ** ** Returns (tBTA_FS_CO_STATUS) status of the call. ** [BTA_FS_CO_OK if successful] ** [BTA_FS_CO_EACCES if read-only] ** [BTA_FS_CO_FAIL otherwise] ** *******************************************************************************/ tBTA_FS_CO_STATUS bta_fs_co_unlink(const char *p_path, UINT8 app_id) { BTIF_TRACE_DEBUG("bta_fs_co_unlink"); int err; tBTA_FS_CO_STATUS status = BTA_FS_CO_OK; char *dirName, *tmp=NULL; struct stat buffer; UNUSED(app_id); if(! p_path) return BTA_FS_CO_FAIL; /* buffer needs to be NULL terminated - so add one more byte to be zero'd out */ #if 0 dirName= (char*) calloc(1, strlen(p_path)); /* <--- this can cause problems */ #else dirName= (char*) calloc(1, strlen(p_path) + 1); #endif strncpy(dirName, p_path, strlen(p_path)); if((tmp=strrchr(dirName, '/'))) { *tmp='\0'; } if (stat(dirName, &buffer) == 0) { status=getAccess (6, &buffer, dirName); free(dirName); } else { BTIF_TRACE_DEBUG("stat() failed! "); free(dirName); return BTA_FS_CO_FAIL; } if(status!= BTA_FS_CO_OK) return status; if ((unlink (p_path)) != 0) { err = errno; if (err == EACCES) status = BTA_FS_CO_EACCES; else status = BTA_FS_CO_FAIL; } return (status); }
_Tt_db_results _Tt_db_file::copy (const _Tt_string &new_file) { if (!new_file.len()) { return (dbResults = TT_DB_ERR_ILLEGAL_FILE); } if (isFileInDatabase()) { _Tt_string new_local_path; _Tt_string new_hostname; _Tt_string new_partition; _Tt_string new_network_path; dbResults = _tt_db_network_path(new_file, new_local_path, new_hostname, new_partition, new_network_path); if (dbResults == TT_DB_OK) { // If we're not copying to the exact same file if (dbFileNetworkPath != new_network_path) { setCurrentDBAccess(); _Tt_db_property_list_ptr properties = getProperties(); _Tt_db_access_ptr access = getAccess (); _Tt_string_list_ptr objids = getObjects(); if (dbResults == TT_DB_OK) { _Tt_db_file_ptr new_db_file = new _Tt_db_file(new_network_path, properties, access); _Tt_string_list_cursor objids_cursor(objids); while (objids_cursor.next()) { _Tt_db_object_ptr object = new _Tt_db_object(*objids_cursor); (void)object->copy(new_file); } } } else { dbResults = TT_DB_ERR_SAME_FILE; } } } else { dbResults = TT_DB_ERR_ILLEGAL_FILE; } return dbResults; }
void AccessMap::propagateAccess(string father, map<string, bool> children) { //false value in map indicates that this field is not visible through interface and accessible only by procedures //debug_printf(*ec, "[AccessMap::propagateAccess]: adding %d children for %s", children.size(), father.c_str()); int fatherCrud = getAccess(father); int crud = deriveFatherCrud(fatherCrud); if (crud == NO_ACCESS) return; //Shouldn't happen set<string> accessibleChildren; set<string> procedureOnlyChildren; for (map<string, bool>::iterator it = children.begin(); it != children.end(); ++it) { string name = it->first; bool procedureOnly = !(it->second); if (procedureOnly) procedureOnlyChildren.insert(name); else accessibleChildren.insert(name); } addAccessList(accessibleChildren, crud); addAccessList(procedureOnlyChildren, PROCEDURE_ONLY); }
/******************************************************************************* ** ** Function bta_fs_co_rmdir ** ** Description This function is called to remove a directory whose ** name is given by path. The directory must be empty. ** ** Parameters p_path - (input) name of directory to remove (fully qualified path). ** app_id - (input) application ID specified in the enable functions. ** It can be used to identify which profile is the caller ** of the call-out function. ** ** Returns (tBTA_FS_CO_STATUS) status of the call. ** [BTA_FS_CO_OK if successful] ** [BTA_FS_CO_EACCES if read-only] ** [BTA_FS_CO_ENOTEMPTY if directory is not empty] ** [BTA_FS_CO_FAIL otherwise] ** *******************************************************************************/ tBTA_FS_CO_STATUS bta_fs_co_rmdir(const char *p_path, UINT8 app_id) { int err, path_len; tBTA_FS_CO_STATUS status = BTA_FS_CO_OK; struct stat buffer; char *dirName, *tmp = NULL; path_len = strlen( p_path )+1; BTIF_TRACE_DEBUG( "bta_fs_co_rmdir( app_id: %d ): path_len: %d", app_id, path_len ); #if (TRUE==BTA_FS_DEBUG) BTIF_TRACE_DEBUG( "bta_fs_co_rmdir():path_len: %d, p_path", app_id ); BTIF_TRACE_DEBUG( p_path ); #endif /* allocate a temp buffer for path with 0 char. make sure not to crash if path is too big! */ dirName = (char*) calloc(1, path_len+1); if ( NULL != dirName ) { strcpy( dirName, p_path ); } else { BTIF_TRACE_WARNING( "bta_fs_co_rmdir( app_id: %d ) for path_len: %d::out of memory", app_id, path_len ); return BTA_FS_CO_FAIL; } if (NULL!= (tmp = strrchr(dirName, '/'))) { *tmp = '\0'; } if (stat(dirName, &buffer) == 0) { status = getAccess(6, &buffer, dirName); } else { free(dirName); #if (TRUE==BTA_FS_DEBUG) BTIF_TRACE_WARNING( "bta_fs_co_rmdir()::stat(dirName) failed" ); #endif return BTA_FS_CO_FAIL; } free(dirName); if (status != BTA_FS_CO_OK) { #if (TRUE==BTA_FS_DEBUG) BTIF_TRACE_WARNING( "bta_fs_co_rmdir()::getAccess(dirName) FAILED"); #endif return status; } if (stat(p_path, &buffer) == 0) { status = getAccess(6, &buffer, (char*)p_path); } else { #if (TRUE==BTA_FS_DEBUG) BTIF_TRACE_WARNING( "bta_fs_co_rmdir()::stat(p_path) FAILED"); #endif return BTA_FS_CO_FAIL; } if (status != BTA_FS_CO_OK) { #if (TRUE==BTA_FS_DEBUG) BTIF_TRACE_DEBUG( "bta_fs_co_rmdir()::getAccess(p_path) FAILED"); #endif return status; } //if ((rmdir (p_path)) != 0) if (del_path(p_path) != 0) { err = errno; BTIF_TRACE_WARNING( "bta_fs_co_rmdir():rmdir/del_path FAILED with err: %d", err ); if (err == EACCES) status = BTA_FS_CO_EACCES; else if (err == ENOTEMPTY) status = BTA_FS_CO_ENOTEMPTY; else status = BTA_FS_CO_FAIL; } return (status); }
bool AccessMap::hasAccess(int access, string objectName) const { int crud = getAccess(objectName); //debug_printf(*ec, "user is %s, asking for %d access to %s, found rights = %d, cross = %d", m_isDba ? "dba" : "not dba", access, objectName.c_str(), crud, crud & access); return (access == (crud & access)); }
_Tt_db_results _Tt_db_file::move (const _Tt_string &new_file) { if (!new_file.len()) { return (dbResults = TT_DB_ERR_ILLEGAL_FILE); } if (isFileInDatabase()) { // Get the hostname and remote path of the new file _Tt_string new_local_path; _Tt_string new_hostname; _Tt_string new_partition; _Tt_string new_network_path; dbResults = _tt_db_network_path(new_file, new_local_path, new_hostname, new_partition, new_network_path); if (dbResults == TT_DB_OK) { // If we're not moving to the exact same file if (dbFileNetworkPath != new_network_path) { setCurrentDBAccess(); if (dbResults == TT_DB_OK) { // If is the new file is on the same machine... if (dbFileHostname == new_hostname) { // We're not allowed to move directories across partitions if (directoryFlag && (dbFilePartition != new_partition)) { dbResults = TT_DB_ERR_ILLEGAL_FILE; } else { dbResults = dbFileDatabase->moveFile(dbFileNetworkPath, new_network_path); if (dbResults == TT_DB_OK) { // Change the official file of this object _Tt_db_property_list_ptr properties; _Tt_db_access_ptr access; dbResults = setTtDBFileDefaults(new_network_path, properties, access); } } } // Else, the move is between different hosts... else { // We're not allowed to move directories across machines if (directoryFlag) { dbResults = TT_DB_ERR_ILLEGAL_FILE; } // Not a directory, move it... else { _Tt_db_property_list_ptr properties = getProperties(); _Tt_db_access_ptr access = getAccess (); _Tt_string_list_ptr objids = getObjects(); if (dbResults == TT_DB_OK) { _Tt_db_file_ptr new_db_file = new _Tt_db_file(new_network_path, properties, access); _Tt_string_list_cursor objids_cursor(objids); while (objids_cursor.next()) { _Tt_db_object_ptr object = new _Tt_db_object(*objids_cursor); (void)object->move(new_network_path); } } } if (dbResults == TT_DB_OK) { dbResults = dbFileDatabase->removeFile(dbFileNetworkPath); } if (dbResults == TT_DB_OK) { // Change the official file of this object _Tt_db_property_list_ptr properties; _Tt_db_access_ptr access; dbResults = setTtDBFileDefaults(new_network_path, properties, access); } } } } else { dbResults = TT_DB_ERR_SAME_FILE; } } } else { dbResults = TT_DB_ERR_ILLEGAL_FILE; } return dbResults; }
void SBusController::setPassUpAndWait( bool state ) { if( p->pass_up_and_wait == state ) return; p->pass_up_and_wait = state; if( state ) { /*! ----------------- Find Active Buses ---------------- */ QStringList keys = active_buses->keys(); for( int i=0 ; i<keys.count() ; i++ ) { const QString & bus = keys.at(i); if( !active_buses->contains(bus) ) continue; SBusController *controller = active_buses->value( bus ); if( controller == this ) { finish( bus ); getAccess( bus ); } } } else { /*! ----------------- Find Disabled Buses ---------------- */ QStringList keys = queued_buses->keys(); for( int i=0 ; i<keys.count() ; i++ ) { const QString & bus = keys.at(i); if( active_buses->contains(bus) ) continue; /*! ---------- Find First Deactived Processes to Active --------- */ if( !queued_buses->contains(bus) ) continue; QQueue<SBusController*> *queue = queued_buses->value(bus); if( queue == 0 ) continue; for( int j=0 ; j<queue->count() ; j++ ) { if( queue->at(j) != this ) continue; queue->removeAt( j ); if( queue->isEmpty() ) delete queued_buses->take( bus ); active_buses->insert( bus , this ); emit go(); break; } } } }
bool SBusController::getAccess( SDeviceItem device , const QVariant & data ) { return getAccess( device.deviceFeatures().device_block_str , data ); }
void ServerController::processClient(sf::Packet &packet, sf::TcpSocket &client) { std::string protocol; packet >> protocol; std::cout << "Interpreting Packet Protocol: " << protocol << std::endl; if(protocol=="LOGIN"){ loginAccount(packet, client); } else if(protocol=="REGISTER"){ registerAccount(packet, client); } else if(protocol=="CONFERENCE_LIST"){ getConferences(packet, client); } else if(protocol=="CONFERENCE_ACCESS"){ getAccess(packet, client); } else if(protocol=="VIEW_SUBMISSIONS"){ getSubmissions(packet, client); } else if(protocol=="SUBMIT_PAPER"){ paperSubmission(packet, client); } else if (protocol=="ADMIN_STATUS"){ getAdminStatus(packet, client); } else if (protocol=="CREATE_CONFERENCE"){ createConference(packet, client); } else if (protocol=="GET_NOTIFICATIONS"){ getNotifications(packet, client); } else if (protocol=="CHECK_PHASE"){ checkPhase(packet, client); } else if (protocol=="BID_LIST"){ bidList(packet, client); } else if (protocol=="BID_PAPER"){ bidPaper(packet, client); } else if (protocol=="ADVANCE_PHASE"){ advancePhase(packet, client); } else if(protocol=="BYE"){ logoutUser(packet, client); } else if(protocol=="GET_ALLOCATIONS"){ getAllocations(packet, client); } else if(protocol=="CONFERENCE_SUBMISSIONS"){ getConferenceSubs(packet, client); } else if(protocol=="REVIEW_LIST"){ getReviewList(packet, client, true); } else if (protocol=="SUB_DETAIL"){ sendSubDetail(packet, client); } else if (protocol=="SUBMIT_REVIEW"){ submitReview(packet, client); } else if (protocol=="GET_COMMENTS"){ getComments(packet, client); } else if (protocol=="SEND_COMMENT"){ sendComments(packet, client); } else if (protocol=="ADD_REVIEWER"){ addMember(packet, client, Account::Access_Reviewer); } else if (protocol=="ADD_AUTHOR"){ addMember(packet, client, Account::Access_Author); } else if (protocol=="CHANGE_MAX_ALLOCATED_CONF"){ changeLimit(packet, client, "ALLOCATED"); } else if (protocol=="CHANGE_MAX_PAPERREVIEWERS_CONF"){ changeLimit(packet, client, "PAPERREV"); } else if (protocol=="GET_MAX_ALLOCATED_CONF"){ getLimit(packet, client, "ALLOCATED"); } else if (protocol=="GET_MAX_PAPERREVIEWERS_CONF"){ getLimit(packet, client, "PAPERREV"); } else if (protocol=="GET_FULLNAME"){ getAccountName(packet, client); } else if (protocol=="VIEW_REVIEW"){ getReview(packet, client); } else if (protocol=="NOTIFY_COUNT"){ checkNotifyCount(packet, client); } else if (protocol=="APPROVE_PAPER"){ decidePaper(packet, client, true); } else if (protocol=="REJECT_PAPER"){ decidePaper(packet, client, false); } else if (protocol=="MY_REVIEWS"){ getReviewList(packet, client, false); } else if (protocol=="DID_REVIEW"){ checkReviewed(packet, client); } else if (protocol=="FINAL_REVIEW"){ getFinalReview(packet, client); } else if (protocol=="CONF_REVIEWERS"){ getReviewers(packet, client); } else if (protocol=="CONF_SUBMISSIONS"){ getConfSubmissions(packet, client); } else if (protocol=="FILLED_ALLOCATION"){ checkPaperAlloc(packet, client); } else if (protocol=="GET_FREE_REVIEWERS"){ getFreeReviewers(packet, client); } else if (protocol=="ASSIGN_REVIEWER"){ assignReviewer(packet, client); } else if (protocol=="CHANGE_PASSWORD"){ changePassword(packet, client); } else { std::cout << "Unrecognised protocol" << std::endl; } }
/******************************* * Do access check for member of this class, this class being the * type of the 'this' pointer used to access smember. * Returns true if the member is not accessible. */ bool checkAccess(AggregateDeclaration *ad, Loc loc, Scope *sc, Dsymbol *smember) { FuncDeclaration *f = sc->func; AggregateDeclaration *cdscope = sc->getStructClassScope(); #if LOG printf("AggregateDeclaration::checkAccess() for %s.%s in function %s() in scope %s\n", ad->toChars(), smember->toChars(), f ? f->toChars() : NULL, cdscope ? cdscope->toChars() : NULL); #endif Dsymbol *smemberparent = smember->toParent(); if (!smemberparent || !smemberparent->isAggregateDeclaration()) { #if LOG printf("not an aggregate member\n"); #endif return false; // then it is accessible } // BUG: should enable this check //assert(smember->parent->isBaseOf(this, NULL)); bool result; Prot access; if (smemberparent == ad) { Prot access2 = smember->prot(); result = access2.kind >= PROTpublic || hasPrivateAccess(ad, f) || isFriendOf(ad, cdscope) || (access2.kind == PROTpackage && hasPackageAccess(sc, ad)) || ad->getAccessModule() == sc->module; #if LOG printf("result1 = %d\n", result); #endif } else if ((access = getAccess(ad, smember)).kind >= PROTpublic) { result = true; #if LOG printf("result2 = %d\n", result); #endif } else if (access.kind == PROTpackage && hasPackageAccess(sc, ad)) { result = true; #if LOG printf("result3 = %d\n", result); #endif } else { result = isAccessible(smember, f, ad, cdscope); #if LOG printf("result4 = %d\n", result); #endif } if (!result) { ad->error(loc, "member %s is not accessible", smember->toChars()); //printf("smember = %s %s, prot = %d, semanticRun = %d\n", // smember->kind(), smember->toPrettyChars(), smember->prot(), smember->semanticRun); return true; } return false; }