pull/105/head
Apex Liu 2018-03-15 02:04:47 +08:00
parent 33eead9f05
commit e848c6ccbd
2 changed files with 17 additions and 5 deletions

View File

@ -471,6 +471,9 @@ int SshSession::_on_auth_password_request(ssh_session session, const char *user,
// int flag = SSH_LOG_FUNCTIONS;
// ssh_options_set(_this->m_srv_session, SSH_OPTIONS_LOG_VERBOSITY, &flag);
#endif
// int val = 0;
// ssh_options_set(_this->m_srv_session, SSH_OPTIONS_STRICTHOSTKEYCHECK, &val);
if (_this->m_auth_type != TP_AUTH_TYPE_NONE)
ssh_options_set(_this->m_srv_session, SSH_OPTIONS_USER, _this->m_acc_name.c_str());
@ -479,14 +482,10 @@ int SshSession::_on_auth_password_request(ssh_session session, const char *user,
int _timeout = 30; // 30 sec.
ssh_options_set(_this->m_srv_session, SSH_OPTIONS_TIMEOUT, &_timeout);
// int val = 0;
// ssh_options_set(_this->m_srv_session, SSH_OPTIONS_STRICTHOSTKEYCHECK, &val);
int rc = 0;
rc = ssh_connect(_this->m_srv_session);
if (rc != SSH_OK) {
EXLOGE("[ssh] can not connect to real SSH server %s:%d. [%d]%s\n", _this->m_conn_ip.c_str(), _this->m_conn_port, rc, ssh_get_error(_this->m_srv_session));
EXLOGE("[ssh] can not connect to real SSH server %s:%d. [%d] %s\n", _this->m_conn_ip.c_str(), _this->m_conn_port, rc, ssh_get_error(_this->m_srv_session));
_this->m_have_error = true;
_this->_session_error(TP_SESS_STAT_ERR_CONNECT);
return SSH_AUTH_ERROR;

View File

@ -185,7 +185,20 @@ def update(handler, gid, name, desc):
def add_members(gtype, gid, members):
# 向指定组中增加成员,同时根据授权策略,更新授权映射表
db = get_db()
# 1. 获取与此组相关的运维授权策略
s = SQL(get_db())
s.select_from('ops_auz', ['id', 'policy_id', 'type', 'state'], alt_name='oa')
s.where('`rtype`={gtype} AND `gid`={gid}'.format(gtype=gtype, gid=gid))
err = s.query()
if err != TPE_OK:
return err
if s.total_count > 0:
pass
sql = []
for uid in members:
sql.append('INSERT INTO `{}group_map` (`type`, `gid`, `mid`) VALUES ({}, {}, {});'.format(db.table_prefix, gtype, gid, uid))