mirror of
https://github.com/libssh2/libssh2.git
synced 2025-08-07 08:02:56 +03:00
Strictening function prototypes: char* -> const char* where applicable
This commit is contained in:
@@ -256,37 +256,37 @@ LIBSSH2_API LIBSSH2_SESSION *libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_all
|
|||||||
LIBSSH2_API void **libssh2_session_abstract(LIBSSH2_SESSION *session);
|
LIBSSH2_API void **libssh2_session_abstract(LIBSSH2_SESSION *session);
|
||||||
|
|
||||||
LIBSSH2_API void *libssh2_session_callback_set(LIBSSH2_SESSION *session, int cbtype, void *callback);
|
LIBSSH2_API void *libssh2_session_callback_set(LIBSSH2_SESSION *session, int cbtype, void *callback);
|
||||||
LIBSSH2_API int libssh2_banner_set(LIBSSH2_SESSION *session, char *banner);
|
LIBSSH2_API int libssh2_banner_set(LIBSSH2_SESSION *session, const char *banner);
|
||||||
|
|
||||||
LIBSSH2_API int libssh2_session_startup(LIBSSH2_SESSION *session, int socket);
|
LIBSSH2_API int libssh2_session_startup(LIBSSH2_SESSION *session, int socket);
|
||||||
LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reason, char *description, char *lang);
|
LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reason, const char *description, const char *lang);
|
||||||
#define libssh2_session_disconnect(session, description) libssh2_session_disconnect_ex((session), SSH_DISCONNECT_BY_APPLICATION, (description), "")
|
#define libssh2_session_disconnect(session, description) libssh2_session_disconnect_ex((session), SSH_DISCONNECT_BY_APPLICATION, (description), "")
|
||||||
LIBSSH2_API void libssh2_session_free(LIBSSH2_SESSION *session);
|
LIBSSH2_API void libssh2_session_free(LIBSSH2_SESSION *session);
|
||||||
|
|
||||||
LIBSSH2_API char *libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type);
|
LIBSSH2_API const char *libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type);
|
||||||
|
|
||||||
LIBSSH2_API int libssh2_session_method_pref(LIBSSH2_SESSION *session, int method_type, char *prefs);
|
LIBSSH2_API int libssh2_session_method_pref(LIBSSH2_SESSION *session, int method_type, const char *prefs);
|
||||||
LIBSSH2_API char *libssh2_session_methods(LIBSSH2_SESSION *session, int method_type);
|
LIBSSH2_API const char *libssh2_session_methods(LIBSSH2_SESSION *session, int method_type);
|
||||||
LIBSSH2_API int libssh2_session_last_error(LIBSSH2_SESSION *session, char **errmsg, int *errmsg_len, int want_buf);
|
LIBSSH2_API int libssh2_session_last_error(LIBSSH2_SESSION *session, char **errmsg, int *errmsg_len, int want_buf);
|
||||||
|
|
||||||
LIBSSH2_API int libssh2_session_flag(LIBSSH2_SESSION *session, int flag, int value);
|
LIBSSH2_API int libssh2_session_flag(LIBSSH2_SESSION *session, int flag, int value);
|
||||||
|
|
||||||
/* Userauth API */
|
/* Userauth API */
|
||||||
LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session, char *username, int username_len);
|
LIBSSH2_API const char *libssh2_userauth_list(LIBSSH2_SESSION *session, const char *username, int username_len);
|
||||||
LIBSSH2_API int libssh2_userauth_authenticated(LIBSSH2_SESSION *session);
|
LIBSSH2_API int libssh2_userauth_authenticated(LIBSSH2_SESSION *session);
|
||||||
LIBSSH2_API int libssh2_userauth_password_ex(LIBSSH2_SESSION *session, char *username, int username_len, char *password, int password_len, LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)));
|
LIBSSH2_API int libssh2_userauth_password_ex(LIBSSH2_SESSION *session, const char *username, int username_len, const char *password, int password_len, LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)));
|
||||||
#define libssh2_userauth_password(session, username, password) libssh2_userauth_password_ex((session), (username), strlen(username), (password), strlen(password), NULL)
|
#define libssh2_userauth_password(session, username, password) libssh2_userauth_password_ex((session), (username), strlen(username), (password), strlen(password), NULL)
|
||||||
|
|
||||||
LIBSSH2_API int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, char *username, int username_len,
|
LIBSSH2_API int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, const char *username, int username_len,
|
||||||
char *publickey, char *privatekey,
|
const char *publickey, const char *privatekey,
|
||||||
char *passphrase);
|
const char *passphrase);
|
||||||
#define libssh2_userauth_publickey_fromfile(session, username, publickey, privatekey, passphrase) \
|
#define libssh2_userauth_publickey_fromfile(session, username, publickey, privatekey, passphrase) \
|
||||||
libssh2_userauth_publickey_fromfile_ex((session), (username), strlen(username), (publickey), (privatekey), (passphrase))
|
libssh2_userauth_publickey_fromfile_ex((session), (username), strlen(username), (publickey), (privatekey), (passphrase))
|
||||||
LIBSSH2_API int libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session, char *username, int username_len,
|
LIBSSH2_API int libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session, const char *username, int username_len,
|
||||||
char *publickey, char *privatekey,
|
const char *publickey, const char *privatekey,
|
||||||
char *passphrase,
|
const char *passphrase,
|
||||||
char *hostname, int hostname_len,
|
const char *hostname, int hostname_len,
|
||||||
char *local_username, int local_username_len);
|
const char *local_username, int local_username_len);
|
||||||
#define libssh2_userauth_hostbased_fromfile(session, username, publickey, privatekey, passphrase, hostname) \
|
#define libssh2_userauth_hostbased_fromfile(session, username, publickey, privatekey, passphrase, hostname) \
|
||||||
libssh2_userauth_hostbased_fromfile_ex((session), (username), strlen(username), (publickey), (privatekey), (passphrase), (hostname), strlen(hostname), (username), strlen(username))
|
libssh2_userauth_hostbased_fromfile_ex((session), (username), strlen(username), (publickey), (privatekey), (passphrase), (hostname), strlen(hostname), (username), strlen(username))
|
||||||
|
|
||||||
@@ -315,7 +315,7 @@ LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeou
|
|||||||
|
|
||||||
#define SSH_EXTENDED_DATA_STDERR 1
|
#define SSH_EXTENDED_DATA_STDERR 1
|
||||||
|
|
||||||
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_channel_open_ex(LIBSSH2_SESSION *session, char *channel_type, int channel_type_len, int window_size, int packet_size, char *message, int message_len);
|
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type, int channel_type_len, int window_size, int packet_size, const char *message, int message_len);
|
||||||
#define libssh2_channel_open_session(session) libssh2_channel_open_ex((session), "session", sizeof("session") - 1, LIBSSH2_CHANNEL_WINDOW_DEFAULT, LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0)
|
#define libssh2_channel_open_session(session) libssh2_channel_open_ex((session), "session", sizeof("session") - 1, LIBSSH2_CHANNEL_WINDOW_DEFAULT, LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0)
|
||||||
|
|
||||||
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, char *host, int port, char *shost, int sport);
|
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, char *host, int port, char *shost, int sport);
|
||||||
@@ -337,7 +337,7 @@ LIBSSH2_API int libssh2_channel_request_pty_ex(LIBSSH2_CHANNEL *channel, char *t
|
|||||||
LIBSSH2_API int libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel, int single_connection, char *auth_proto, char *auth_cookie, int screen_number);
|
LIBSSH2_API int libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel, int single_connection, char *auth_proto, char *auth_cookie, int screen_number);
|
||||||
#define libssh2_channel_x11_req(channel, screen_number) libssh2_channel_x11_req_ex((channel), 0, NULL, NULL, (screen_number))
|
#define libssh2_channel_x11_req(channel, screen_number) libssh2_channel_x11_req_ex((channel), 0, NULL, NULL, (screen_number))
|
||||||
|
|
||||||
LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, char *request, int request_len, char *message, int message_len);
|
LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, const char *request, int request_len, const char *message, int message_len);
|
||||||
#define libssh2_channel_shell(channel) libssh2_channel_process_startup((channel), "shell", sizeof("shell") - 1, NULL, 0)
|
#define libssh2_channel_shell(channel) libssh2_channel_process_startup((channel), "shell", sizeof("shell") - 1, NULL, 0)
|
||||||
#define libssh2_channel_exec(channel, command) libssh2_channel_process_startup((channel), "exec", sizeof("exec") - 1, (command), strlen(command))
|
#define libssh2_channel_exec(channel, command) libssh2_channel_process_startup((channel), "exec", sizeof("exec") - 1, (command), strlen(command))
|
||||||
#define libssh2_channel_subsystem(channel, subsystem) libssh2_channel_process_startup((channel), "subsystem", sizeof("subsystem") - 1, (subsystem), strlen(subsystem))
|
#define libssh2_channel_subsystem(channel, subsystem) libssh2_channel_process_startup((channel), "subsystem", sizeof("subsystem") - 1, (subsystem), strlen(subsystem))
|
||||||
@@ -378,8 +378,8 @@ LIBSSH2_API int libssh2_channel_eof(LIBSSH2_CHANNEL *channel);
|
|||||||
LIBSSH2_API int libssh2_channel_close(LIBSSH2_CHANNEL *channel);
|
LIBSSH2_API int libssh2_channel_close(LIBSSH2_CHANNEL *channel);
|
||||||
LIBSSH2_API int libssh2_channel_free(LIBSSH2_CHANNEL *channel);
|
LIBSSH2_API int libssh2_channel_free(LIBSSH2_CHANNEL *channel);
|
||||||
|
|
||||||
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session, char *path, struct stat *sb);
|
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session, const char *path, struct stat *sb);
|
||||||
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session, char *path, int mode, size_t size, long mtime, long atime);
|
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode, size_t size, long mtime, long atime);
|
||||||
#define libssh2_scp_send(session, path, mode, size) libssh2_scp_send_ex((session), (path), (mode), (size), 0, 0)
|
#define libssh2_scp_send(session, path, mode, size) libssh2_scp_send_ex((session), (path), (mode), (size), 0, 0)
|
||||||
|
|
||||||
LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest, int *dest_len, char *src, int src_len);
|
LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest, int *dest_len, char *src, int src_len);
|
||||||
|
@@ -264,7 +264,7 @@ struct _LIBSSH2_HOSTKEY_METHOD {
|
|||||||
unsigned long hash_len;
|
unsigned long hash_len;
|
||||||
|
|
||||||
int (*init)(LIBSSH2_SESSION *session, unsigned char *hostkey_data, unsigned long hostkey_data_len, void **abstract);
|
int (*init)(LIBSSH2_SESSION *session, unsigned char *hostkey_data, unsigned long hostkey_data_len, void **abstract);
|
||||||
int (*initPEM)(LIBSSH2_SESSION *session, unsigned char *privkeyfile, unsigned char *passphrase, void **abstract);
|
int (*initPEM)(LIBSSH2_SESSION *session, unsigned const char *privkeyfile, unsigned const char *passphrase, void **abstract);
|
||||||
int (*sig_verify)(LIBSSH2_SESSION *session, const unsigned char *sig, unsigned long sig_len, const unsigned char *m, unsigned long m_len, void **abstract);
|
int (*sig_verify)(LIBSSH2_SESSION *session, const unsigned char *sig, unsigned long sig_len, const unsigned char *m, unsigned long m_len, void **abstract);
|
||||||
int (*sign)(LIBSSH2_SESSION *session, unsigned char **signature, unsigned long *signature_len, const unsigned char *data, unsigned long data_len, void **abstract);
|
int (*sign)(LIBSSH2_SESSION *session, unsigned char **signature, unsigned long *signature_len, const unsigned char *data, unsigned long data_len, void **abstract);
|
||||||
int (*signv)(LIBSSH2_SESSION *session, unsigned char **signature, unsigned long *signature_len, unsigned long veccount, const struct iovec datavec[], void **abstract);
|
int (*signv)(LIBSSH2_SESSION *session, unsigned char **signature, unsigned long *signature_len, unsigned long veccount, const struct iovec datavec[], void **abstract);
|
||||||
|
@@ -105,8 +105,8 @@ LIBSSH2_CHANNEL *libssh2_channel_locate(LIBSSH2_SESSION *session, unsigned long
|
|||||||
/* {{{ libssh2_channel_open_session
|
/* {{{ libssh2_channel_open_session
|
||||||
* Establish a generic session channel
|
* Establish a generic session channel
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_channel_open_ex(LIBSSH2_SESSION *session, char *channel_type, int channel_type_len, int window_size, int packet_size,
|
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type, int channel_type_len, int window_size, int packet_size,
|
||||||
char *message, int message_len)
|
const char *message, int message_len)
|
||||||
{
|
{
|
||||||
unsigned char reply_codes[3] = { SSH_MSG_CHANNEL_OPEN_CONFIRMATION, SSH_MSG_CHANNEL_OPEN_FAILURE, 0 };
|
unsigned char reply_codes[3] = { SSH_MSG_CHANNEL_OPEN_CONFIRMATION, SSH_MSG_CHANNEL_OPEN_FAILURE, 0 };
|
||||||
LIBSSH2_CHANNEL *channel = NULL;
|
LIBSSH2_CHANNEL *channel = NULL;
|
||||||
@@ -664,7 +664,7 @@ LIBSSH2_API int libssh2_channel_x11_req_ex(LIBSSH2_CHANNEL *channel, int single_
|
|||||||
/* {{{ libssh2_channel_process_startup
|
/* {{{ libssh2_channel_process_startup
|
||||||
* Primitive for libssh2_channel_(shell|exec|subsystem)
|
* Primitive for libssh2_channel_(shell|exec|subsystem)
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, char *request, int request_len, char *message, int message_len)
|
LIBSSH2_API int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, const char *request, int request_len, const char *message, int message_len)
|
||||||
{
|
{
|
||||||
LIBSSH2_SESSION *session = channel->session;
|
LIBSSH2_SESSION *session = channel->session;
|
||||||
unsigned char *s, *packet, *data, reply_codes[3] = { SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, 0 }, local_channel[4];
|
unsigned char *s, *packet, *data, reply_codes[3] = { SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, 0 }, local_channel[4];
|
||||||
|
@@ -109,7 +109,7 @@ static int libssh2_hostkey_method_ssh_rsadsa_passphrase_cb(char *buf, int size,
|
|||||||
/* {{{ libssh2_hostkey_method_ssh_rsa_initPEM
|
/* {{{ libssh2_hostkey_method_ssh_rsa_initPEM
|
||||||
* Load a Private Key from a PEM file
|
* Load a Private Key from a PEM file
|
||||||
*/
|
*/
|
||||||
static int libssh2_hostkey_method_ssh_rsa_initPEM(LIBSSH2_SESSION *session, unsigned char *privkeyfile, unsigned char *passphrase, void **abstract)
|
static int libssh2_hostkey_method_ssh_rsa_initPEM(LIBSSH2_SESSION *session, unsigned const char *privkeyfile, unsigned const char *passphrase, void **abstract)
|
||||||
{
|
{
|
||||||
RSA *rsactx;
|
RSA *rsactx;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -131,7 +131,7 @@ static int libssh2_hostkey_method_ssh_rsa_initPEM(LIBSSH2_SESSION *session, unsi
|
|||||||
*/
|
*/
|
||||||
OpenSSL_add_all_ciphers();
|
OpenSSL_add_all_ciphers();
|
||||||
}
|
}
|
||||||
rsactx = PEM_read_RSAPrivateKey(fp, NULL, (void*)libssh2_hostkey_method_ssh_rsadsa_passphrase_cb, passphrase);
|
rsactx = PEM_read_RSAPrivateKey(fp, NULL, (void*)libssh2_hostkey_method_ssh_rsadsa_passphrase_cb, (void*)passphrase);
|
||||||
if (!rsactx) {
|
if (!rsactx) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -323,7 +323,7 @@ static int libssh2_hostkey_method_ssh_dss_init(LIBSSH2_SESSION *session, unsigne
|
|||||||
/* {{{ libssh2_hostkey_method_ssh_dss_initPEM
|
/* {{{ libssh2_hostkey_method_ssh_dss_initPEM
|
||||||
* Load a Private Key from a PEM file
|
* Load a Private Key from a PEM file
|
||||||
*/
|
*/
|
||||||
static int libssh2_hostkey_method_ssh_dss_initPEM(LIBSSH2_SESSION *session, unsigned char *privkeyfile, unsigned char *passphrase, void **abstract)
|
static int libssh2_hostkey_method_ssh_dss_initPEM(LIBSSH2_SESSION *session, unsigned const char *privkeyfile, unsigned const char *passphrase, void **abstract)
|
||||||
{
|
{
|
||||||
DSA *dsactx;
|
DSA *dsactx;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -345,7 +345,7 @@ static int libssh2_hostkey_method_ssh_dss_initPEM(LIBSSH2_SESSION *session, unsi
|
|||||||
*/
|
*/
|
||||||
OpenSSL_add_all_ciphers();
|
OpenSSL_add_all_ciphers();
|
||||||
}
|
}
|
||||||
dsactx = PEM_read_DSAPrivateKey(fp, NULL, (void*)libssh2_hostkey_method_ssh_rsadsa_passphrase_cb, passphrase);
|
dsactx = PEM_read_DSAPrivateKey(fp, NULL, (void*)libssh2_hostkey_method_ssh_rsadsa_passphrase_cb, (void*)passphrase);
|
||||||
if (!dsactx) {
|
if (!dsactx) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -523,7 +523,7 @@ LIBSSH2_HOSTKEY_METHOD **libssh2_hostkey_methods(void)
|
|||||||
* Length of buffer is determined by hash type
|
* Length of buffer is determined by hash type
|
||||||
* i.e. MD5 == 16, SHA1 == 20
|
* i.e. MD5 == 16, SHA1 == 20
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API char *libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type)
|
LIBSSH2_API const char *libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type)
|
||||||
{
|
{
|
||||||
switch (hash_type) {
|
switch (hash_type) {
|
||||||
#ifndef OPENSSL_NO_MD5
|
#ifndef OPENSSL_NO_MD5
|
||||||
|
@@ -1287,7 +1287,7 @@ int libssh2_kex_exchange(LIBSSH2_SESSION *session, int reexchange) /* session->f
|
|||||||
/* {{{ libssh2_session_method_pref
|
/* {{{ libssh2_session_method_pref
|
||||||
* Set preferred method
|
* Set preferred method
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API int libssh2_session_method_pref(LIBSSH2_SESSION *session, int method_type, char *prefs)
|
LIBSSH2_API int libssh2_session_method_pref(LIBSSH2_SESSION *session, int method_type, const char *prefs)
|
||||||
{
|
{
|
||||||
char **prefvar, *s, *newprefs;
|
char **prefvar, *s, *newprefs;
|
||||||
int prefs_len = strlen(prefs);
|
int prefs_len = strlen(prefs);
|
||||||
|
@@ -44,7 +44,7 @@
|
|||||||
/* {{{ libssh2_scp_recv
|
/* {{{ libssh2_scp_recv
|
||||||
* Open a channel and request a remote file via SCP
|
* Open a channel and request a remote file via SCP
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session, char *path, struct stat *sb)
|
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session, const char *path, struct stat *sb)
|
||||||
{
|
{
|
||||||
int path_len = strlen(path);
|
int path_len = strlen(path);
|
||||||
unsigned char *command, response[LIBSSH2_SCP_RESPONSE_BUFLEN];
|
unsigned char *command, response[LIBSSH2_SCP_RESPONSE_BUFLEN];
|
||||||
@@ -330,11 +330,12 @@ LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session, char *pa
|
|||||||
/* {{{ libssh2_scp_send_ex
|
/* {{{ libssh2_scp_send_ex
|
||||||
* Send a file using SCP
|
* Send a file using SCP
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session, char *path, int mode, size_t size, long mtime, long atime)
|
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_send_ex(LIBSSH2_SESSION *session, const char *path, int mode, size_t size, long mtime, long atime)
|
||||||
{
|
{
|
||||||
int path_len = strlen(path);
|
int path_len = strlen(path);
|
||||||
unsigned char *command, *base, response[LIBSSH2_SCP_RESPONSE_BUFLEN];
|
unsigned char *command, response[LIBSSH2_SCP_RESPONSE_BUFLEN];
|
||||||
unsigned long response_len, command_len = path_len + sizeof("scp -t ");
|
unsigned long response_len, command_len = path_len + sizeof("scp -t ");
|
||||||
|
unsigned const char *base;
|
||||||
LIBSSH2_CHANNEL *channel;
|
LIBSSH2_CHANNEL *channel;
|
||||||
|
|
||||||
if (mtime || atime) {
|
if (mtime || atime) {
|
||||||
|
@@ -172,7 +172,7 @@ static int libssh2_banner_send(LIBSSH2_SESSION *session)
|
|||||||
/* {{{ libssh2_banner_set
|
/* {{{ libssh2_banner_set
|
||||||
* Set the local banner
|
* Set the local banner
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API int libssh2_banner_set(LIBSSH2_SESSION *session, char *banner)
|
LIBSSH2_API int libssh2_banner_set(LIBSSH2_SESSION *session, const char *banner)
|
||||||
{
|
{
|
||||||
int banner_len = banner ? strlen(banner) : 0;
|
int banner_len = banner ? strlen(banner) : 0;
|
||||||
|
|
||||||
@@ -497,7 +497,7 @@ LIBSSH2_API void libssh2_session_free(LIBSSH2_SESSION *session)
|
|||||||
|
|
||||||
/* {{{ libssh2_session_disconnect_ex
|
/* {{{ libssh2_session_disconnect_ex
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reason, char *description, char *lang)
|
LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reason, const char *description, const char *lang)
|
||||||
{
|
{
|
||||||
unsigned char *s, *data;
|
unsigned char *s, *data;
|
||||||
unsigned long data_len, descr_len = 0, lang_len = 0;
|
unsigned long data_len, descr_len = 0, lang_len = 0;
|
||||||
@@ -547,7 +547,7 @@ LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session, int reas
|
|||||||
* NOTE: Currently lang_cs and lang_sc are ALWAYS set to empty string regardless of actual negotiation
|
* NOTE: Currently lang_cs and lang_sc are ALWAYS set to empty string regardless of actual negotiation
|
||||||
* Strings should NOT be freed
|
* Strings should NOT be freed
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API char *libssh2_session_methods(LIBSSH2_SESSION *session, int method_type)
|
LIBSSH2_API const char *libssh2_session_methods(LIBSSH2_SESSION *session, int method_type)
|
||||||
{
|
{
|
||||||
/* All methods have char *name as their first element */
|
/* All methods have char *name as their first element */
|
||||||
LIBSSH2_KEX_METHOD *method = NULL;
|
LIBSSH2_KEX_METHOD *method = NULL;
|
||||||
|
@@ -49,7 +49,7 @@
|
|||||||
* Not a common configuration for any SSH server though
|
* Not a common configuration for any SSH server though
|
||||||
* username should be NULL, or a null terminated string
|
* username should be NULL, or a null terminated string
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session, char *username, int username_len)
|
LIBSSH2_API const char *libssh2_userauth_list(LIBSSH2_SESSION *session, const char *username, int username_len)
|
||||||
{
|
{
|
||||||
unsigned char reply_codes[3] = { SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE, 0 };
|
unsigned char reply_codes[3] = { SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE, 0 };
|
||||||
unsigned long data_len = username_len + 31; /* packet_type(1) + username_len(4) + service_len(4) + service(14)"ssh-connection" +
|
unsigned long data_len = username_len + 31; /* packet_type(1) + username_len(4) + service_len(4) + service(14)"ssh-connection" +
|
||||||
@@ -116,8 +116,8 @@ LIBSSH2_API int libssh2_userauth_authenticated(LIBSSH2_SESSION *session)
|
|||||||
/* {{{ libssh2_userauth_password
|
/* {{{ libssh2_userauth_password
|
||||||
* Plain ol' login
|
* Plain ol' login
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API int libssh2_userauth_password_ex(LIBSSH2_SESSION *session, char *username, int username_len,
|
LIBSSH2_API int libssh2_userauth_password_ex(LIBSSH2_SESSION *session, const char *username, int username_len,
|
||||||
char *password, int password_len,
|
const char *password, int password_len,
|
||||||
LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)))
|
LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)))
|
||||||
{
|
{
|
||||||
unsigned char *data, *s, reply_codes[4] = { SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE, SSH_MSG_USERAUTH_PASSWD_CHANGEREQ, 0 };
|
unsigned char *data, *s, reply_codes[4] = { SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE, SSH_MSG_USERAUTH_PASSWD_CHANGEREQ, 0 };
|
||||||
@@ -235,7 +235,7 @@ LIBSSH2_API int libssh2_userauth_password_ex(LIBSSH2_SESSION *session, char *use
|
|||||||
*/
|
*/
|
||||||
static int libssh2_file_read_publickey(LIBSSH2_SESSION *session, unsigned char **method, unsigned long *method_len,
|
static int libssh2_file_read_publickey(LIBSSH2_SESSION *session, unsigned char **method, unsigned long *method_len,
|
||||||
unsigned char **pubkeydata, unsigned long *pubkeydata_len,
|
unsigned char **pubkeydata, unsigned long *pubkeydata_len,
|
||||||
char *pubkeyfile)
|
const char *pubkeyfile)
|
||||||
{
|
{
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
char *pubkey = NULL, c, *sp1, *sp2, *tmp;
|
char *pubkey = NULL, c, *sp1, *sp2, *tmp;
|
||||||
@@ -310,12 +310,12 @@ static int libssh2_file_read_publickey(LIBSSH2_SESSION *session, unsigned char *
|
|||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ libssh2_file_read_publickey
|
/* {{{ libssh2_file_read_privatekey
|
||||||
* Read a PEM encoded private key from an id_??? style file
|
* Read a PEM encoded private key from an id_??? style file
|
||||||
*/
|
*/
|
||||||
static int libssh2_file_read_privatekey(LIBSSH2_SESSION *session, LIBSSH2_HOSTKEY_METHOD **hostkey_method, void **hostkey_abstract,
|
static int libssh2_file_read_privatekey(LIBSSH2_SESSION *session, LIBSSH2_HOSTKEY_METHOD **hostkey_method, void **hostkey_abstract,
|
||||||
char *method, int method_len,
|
const char *method, int method_len,
|
||||||
char *privkeyfile, char *passphrase)
|
const char *privkeyfile, const char *passphrase)
|
||||||
{
|
{
|
||||||
LIBSSH2_HOSTKEY_METHOD **hostkey_methods_avail = libssh2_hostkey_methods();
|
LIBSSH2_HOSTKEY_METHOD **hostkey_methods_avail = libssh2_hostkey_methods();
|
||||||
|
|
||||||
@@ -349,11 +349,11 @@ static int libssh2_file_read_privatekey(LIBSSH2_SESSION *session, LIBSSH2_HOSTKE
|
|||||||
/* {{{ libssh2_userauth_hostbased_fromfile_ex
|
/* {{{ libssh2_userauth_hostbased_fromfile_ex
|
||||||
* Authenticate using a keypair found in the named files
|
* Authenticate using a keypair found in the named files
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API int libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session, char *username, int username_len,
|
LIBSSH2_API int libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session, const char *username, int username_len,
|
||||||
char *publickey, char *privatekey,
|
const char *publickey, const char *privatekey,
|
||||||
char *passphrase,
|
const char *passphrase,
|
||||||
char *hostname, int hostname_len,
|
const char *hostname, int hostname_len,
|
||||||
char *local_username, int local_username_len)
|
const char *local_username, int local_username_len)
|
||||||
{
|
{
|
||||||
LIBSSH2_HOSTKEY_METHOD *privkeyobj;
|
LIBSSH2_HOSTKEY_METHOD *privkeyobj;
|
||||||
void *abstract;
|
void *abstract;
|
||||||
@@ -480,9 +480,9 @@ LIBSSH2_API int libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session,
|
|||||||
/* {{{ libssh2_userauth_publickey_fromfile_ex
|
/* {{{ libssh2_userauth_publickey_fromfile_ex
|
||||||
* Authenticate using a keypair found in the named files
|
* Authenticate using a keypair found in the named files
|
||||||
*/
|
*/
|
||||||
LIBSSH2_API int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, char *username, int username_len,
|
LIBSSH2_API int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, const char *username, int username_len,
|
||||||
char *publickey, char *privatekey,
|
const char *publickey, const char *privatekey,
|
||||||
char *passphrase)
|
const char *passphrase)
|
||||||
{
|
{
|
||||||
LIBSSH2_HOSTKEY_METHOD *privkeyobj;
|
LIBSSH2_HOSTKEY_METHOD *privkeyobj;
|
||||||
void *abstract;
|
void *abstract;
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int sock, i, auth_pw = 1;
|
int sock, i, auth_pw = 1;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
LIBSSH2_CHANNEL *channel;
|
LIBSSH2_CHANNEL *channel;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
Reference in New Issue
Block a user