void Authenticator::close_session(void) { switch((last_result=pam_close_session(pam_handle, 0))) { // The documentation and implementation of Linux PAM differs: // PAM_SESSION_ERROR is described in the documentation but // don't exists in the actual implementation. This issue needs // to be fixes at some point. default: //case PAM_SESSION_ERROR: pam_setcred(pam_handle, PAM_DELETE_CRED); _end(); throw Exception(pam_handle, "pam_close_session", last_result); case PAM_SUCCESS: break; }; switch((last_result=pam_setcred(pam_handle, PAM_DELETE_CRED))) { default: case PAM_CRED_ERR: case PAM_CRED_UNAVAIL: case PAM_CRED_EXPIRED: case PAM_USER_UNKNOWN: _end(); throw Exception(pam_handle, "pam_setcred()", last_result); case PAM_SUCCESS: break; } return; }
bool nevil::trial_controller::run() { if (_current_generation < _max_generation_num) { if (_current_individual < _population_size) { if (_current_step == 0 && _current_individual != _population_size) _trial->reset(); if (_current_step < _max_step_num) { _trial->update(); ++_current_step; } else { ++_current_individual; _current_step = 0; } } else { _evaluate(); ++_current_generation; _current_individual = 0; _current_step = 0; printf("-Trial %d: running generation %d\n", _trial_id, _current_generation); } return true; } _end(); return false; }
inline void copy_strtrans(std::basic_string<CharOut, std::char_traits<CharOut>, std::allocator<CharOut>>& out, const Char* in) { if (!in) { out.clear(); return; } out.assign(_begin(in), _end(in)); }
void Authenticator::fail_delay(const unsigned int micro_sec) { switch((last_result=pam_fail_delay(pam_handle, micro_sec))) { default: _end(); throw Exception(pam_handle, "fail_delay()", last_result); case PAM_SUCCESS: break; } return; }
void Authenticator::end(void) { switch((last_result=_end())) { default: throw Exception(pam_handle, "pam_end()", last_result); case PAM_SUCCESS: break; } return; }
void Authenticator::set_item(const Authenticator::ItemType item, const void* value) { switch((last_result=pam_set_item(pam_handle, item, value))) { default: _end(); throw Exception(pam_handle, "pam_set_item()", last_result); case PAM_SUCCESS: break; } return; }
void Authenticator::authenticate(void) { switch((last_result=pam_authenticate(pam_handle, 0))) { default: case PAM_ABORT: _end(); throw Exception(pam_handle, "pam_authenticate()", last_result); case PAM_AUTHINFO_UNAVAIL: case PAM_USER_UNKNOWN: case PAM_MAXTRIES: case PAM_CRED_INSUFFICIENT: case PAM_AUTH_ERR: throw Auth_Exception(pam_handle, "pam_authentication()", last_result); case PAM_SUCCESS: break; } switch((last_result=pam_acct_mgmt(pam_handle, PAM_SILENT))) { // The documentation and implementation of Linux PAM differs: // PAM_NEW_AUTHTOKEN_REQD is described in the documentation but // don't exists in the actual implementation. This issue needs // to be fixes at some point. default: //case PAM_NEW_AUTHTOKEN_REQD: case PAM_ACCT_EXPIRED: case PAM_USER_UNKNOWN: _end(); throw Exception(pam_handle, "pam_acct_mgmt()", last_result); case PAM_AUTH_ERR: case PAM_PERM_DENIED: throw Auth_Exception(pam_handle, "pam_acct_mgmt()", last_result); case PAM_SUCCESS: break; }; return; }
// // endList // void XHTMLR::endList(const std::string &key){ _end(key); _indent(); // // 'start' and 'end' tag have to match // and we just decided to call the tag '_startListTag' // because it was easy to remember that way: // _ss << "</" << _startListTag << ">" << std::endl; }
void CBCGPScanliner::Attach ( LPBYTE data, const CRect& rect, size_t height/* = 0*/, size_t pitch/* = 0*/, BYTE channels/* = 1*/, BOOL invert/* = FALSE*/ ) { Empty(); ASSERT(data != NULL); CPoint point(rect.TopLeft()); CSize size(rect.Size()); if(pitch == 0) { pitch = size.cx; } if(height == 0) { height = point.y + size.cy; } ASSERT((size_t)size.cx <= pitch); ASSERT((size_t)(point.y + size.cy) <= height); m_rows = size.cy; m_cols = size.cx * channels; m_pitch = (DWORD)pitch; m_offset = (int)m_pitch; if (invert) { m_offset = -m_offset; } m_channels = channels; m_height = (DWORD)height; m_start_row = point.y; m_start_col = point.x; m_line_begin = _begin(data); m_line_end = _end(data); m_line = m_line_begin; }
const void* Authenticator::get_item(const Authenticator::ItemType item) { const void* data; switch ((last_result=pam_get_item(pam_handle, item, &data))) { default: case PAM_SYSTEM_ERR: #ifdef __LIBPAM_VERSION case PAM_BAD_ITEM: #endif _end(); throw Exception(pam_handle, "pam_get_item()", last_result); case PAM_PERM_DENIED: // The value of item was NULL case PAM_SUCCESS: break; } return data; }
void Authenticator::delenv(const std::string& key) { switch((last_result=pam_putenv(pam_handle, key.c_str()))) { default: case PAM_PERM_DENIED: case PAM_ABORT: case PAM_BUF_ERR: #ifdef __LIBPAM_VERSION case PAM_BAD_ITEM: #endif _end(); throw Exception(pam_handle, "pam_putenv()", last_result); case PAM_SUCCESS: break; }; return; }
void handle_keyboard(unsigned char key, int x, int y) { switch (key) { case 'Q': case 'q': case 'Z': case 'z': _end(); break; case 'h': case 'H': printf("\'?\' for help\n"); camera->init(); break; case 't': case 'T': windowdump = 1; break; case 'r': // Toggle image recording case 'R': movierecord = !movierecord; break; case 'w': // Translate camera up case 'W': camera->key_up(); break; case 's': // Translate camera down case 'S': camera->key_down(); break; case 'a': // Translate camera left case 'A': camera->key_left(); break; case 'd': // Translate camera right case 'D': camera->key_right(); break; case 'o': case 'O': rotate = !rotate; default: _keyboard(key); // Check for user-defined key controls } }
// // end // void XHTMLR::end(const std::string &key){ _end(key); _indent(); // // We need to know if the *parent* is a list: // if( _isAListContainer() ){ _ss << "</" << _listItemTag << ">" << std::endl; }else{ // // 'start' and 'end' tag have to match // and we just decided to call the tag '_startTag' // because it was easy to remember that way: // _ss << "</" << _startTag << ">" << std::endl; } }
bool Command::cycle() { bool finished = false; if (!initialized) { initialize(); _initialize(); initialized = true; } else if (isFinished()) { finished = true; end(); _end(); } else { execute(); _execute(); } return finished; }
void fiasco(char* msg) { term_put_string(msg); term_put_string("\n ------ pizdec ------ "); _end(); }
iterator end() { return iterator(_end()); }
Authenticator::~Authenticator(void) { if (pam_handle) _end(); }