示例#1
0
def _ssh_options_set_long(ssh_session, type_, value):
    value_long = c_long(value)
    result = c_ssh_options_set(c_void_p(ssh_session), c_int(type_),
                               cast(byref(value_long), c_void_p))

    if result < 0:
        error = ssh_get_error(ssh_session)
        raise SshError("Could not set LONG option (%d) to (%d): %s" %
                       (type_, value, error))
示例#2
0
文件: ssha.py 项目: dsoprea/PySecure
def _ssh_options_set_long(ssh_session, type_, value):
    value_long = c_long(value)
    result = c_ssh_options_set(c_void_p(ssh_session), 
                               c_int(type_), 
                               cast(byref(value_long), c_void_p))

    if result < 0:
        error = ssh_get_error(ssh_session)
        raise SshError("Could not set LONG option (%d) to (%d): %s" % 
                       (type_, value, error))
示例#3
0
def _ssh_options_set_string(ssh_session, type_, value):
    assert issubclass(value.__class__, str)

    value_charp = c_char_p(bytify(value))

    result = c_ssh_options_set(c_void_p(ssh_session), c_int(type_),
                               cast(value_charp, c_void_p))

    if result < 0:
        error = ssh_get_error(ssh_session)
        raise SshError("Could not set STRING option (%d) to [%s]: %s" %
                       (type_, value, error))
示例#4
0
文件: ssha.py 项目: dsoprea/PySecure
def _ssh_options_set_string(ssh_session, type_, value):
    assert issubclass(value.__class__, str)

    value_charp = c_char_p(bytify(value))

    result = c_ssh_options_set(c_void_p(ssh_session), 
                               c_int(type_), 
                               cast(value_charp, c_void_p))

    if result < 0:
        error = ssh_get_error(ssh_session)
        raise SshError("Could not set STRING option (%d) to [%s]: %s" % 
                       (type_, value, error))