1
1

Fix build warnings, mostly const chars.

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@394 7dcaeef0-15fb-0310-b436-a5af3365683c
Этот коммит содержится в:
Andreas Schneider 2009-04-05 09:41:54 +00:00
родитель ef1a41efcf
Коммит 139eb4696c
3 изменённых файлов: 26 добавлений и 21 удалений

Просмотреть файл

@ -253,26 +253,28 @@ STRING *publickey_to_string(PUBLIC_KEY *key);
PUBLIC_KEY *publickey_from_privatekey(PRIVATE_KEY *prv); PUBLIC_KEY *publickey_from_privatekey(PRIVATE_KEY *prv);
void private_key_free(PRIVATE_KEY *prv); void private_key_free(PRIVATE_KEY *prv);
STRING *publickey_from_file(SSH_SESSION *session, char *filename,int *_type); STRING *publickey_from_file(SSH_SESSION *session, char *filename,int *_type);
STRING *publickey_from_next_file(SSH_SESSION *session,char **pub_keys_path,char **keys_path, STRING *publickey_from_next_file(SSH_SESSION *session, const char **pub_keys_path,
char **privkeyfile,int *type,int *count); const char **keys_path, char **privkeyfile, int *type, int *count);
int ssh_is_server_known(SSH_SESSION *session); int ssh_is_server_known(SSH_SESSION *session);
int ssh_write_knownhost(SSH_SESSION *session); int ssh_write_knownhost(SSH_SESSION *session);
/* in channels.c */ /* in channels.c */
CHANNEL *channel_new(SSH_SESSION *session); CHANNEL *channel_new(SSH_SESSION *session);
int channel_open_forward(CHANNEL *channel,char *remotehost, int remoteport, char *sourcehost, int localport); int channel_open_forward(CHANNEL *channel, const char *remotehost,
int remoteport, const char *sourcehost, int localport);
int channel_open_session(CHANNEL *channel); int channel_open_session(CHANNEL *channel);
void channel_free(CHANNEL *channel); void channel_free(CHANNEL *channel);
int channel_request_pty(CHANNEL *channel); int channel_request_pty(CHANNEL *channel);
int channel_request_pty_size(CHANNEL *channel, char *term,int cols, int rows); int channel_request_pty_size(CHANNEL *channel, const char *term,
int cols, int rows);
int channel_change_pty_size(CHANNEL *channel,int cols,int rows); int channel_change_pty_size(CHANNEL *channel,int cols,int rows);
int channel_request_shell(CHANNEL *channel); int channel_request_shell(CHANNEL *channel);
int channel_request_subsystem(CHANNEL *channel, char *system); int channel_request_subsystem(CHANNEL *channel, const char *system);
int channel_request_env(CHANNEL *channel,char *name, char *value); int channel_request_env(CHANNEL *channel, const char *name, const char *value);
int channel_request_exec(CHANNEL *channel, char *cmd); int channel_request_exec(CHANNEL *channel, const char *cmd);
int channel_request_sftp(CHANNEL *channel); int channel_request_sftp(CHANNEL *channel);
int channel_write(CHANNEL *channel, void *data, u32 len); int channel_write(CHANNEL *channel, const void *data, u32 len);
int channel_send_eof(CHANNEL *channel); int channel_send_eof(CHANNEL *channel);
int channel_is_eof(CHANNEL *channel); int channel_is_eof(CHANNEL *channel);
int channel_read(CHANNEL *channel, BUFFER *buffer, u32 bytes, int is_stderr); int channel_read(CHANNEL *channel, BUFFER *buffer, u32 bytes, int is_stderr);

Просмотреть файл

@ -76,8 +76,8 @@ u32 ssh_channel_new_id(SSH_SESSION *session){
return ret; return ret;
} }
static int channel_open(CHANNEL *channel,char *type_c,int window, static int channel_open(CHANNEL *channel, const char *type_c, int window,
int maxpacket,BUFFER *payload){ int maxpacket, BUFFER *payload) {
SSH_SESSION *session=channel->session; SSH_SESSION *session=channel->session;
STRING *type=string_from_char(type_c); STRING *type=string_from_char(type_c);
u32 foo; u32 foo;
@ -348,7 +348,7 @@ static void channel_rcv_request(SSH_SESSION *session){
if(!strcmp(request,"exit-signal")){ if(!strcmp(request,"exit-signal")){
STRING *signal_s; STRING *signal_s;
char *signal; char *signal;
char *core="(core dumped)"; const char *core = "(core dumped)";
u8 i; u8 i;
signal_s=buffer_get_ssh_string(session->in_buffer); signal_s=buffer_get_ssh_string(session->in_buffer);
if(!signal_s){ if(!signal_s){
@ -459,7 +459,8 @@ int channel_open_session(CHANNEL *channel){
* SSH_OK on success * SSH_OK on success
* \warning API changed from 0.11 * \warning API changed from 0.11
*/ */
int channel_open_forward(CHANNEL *channel,char *remotehost, int remoteport, char *sourcehost, int localport){ int channel_open_forward(CHANNEL *channel, const char *remotehost,
int remoteport, const char *sourcehost, int localport) {
BUFFER *payload=buffer_new(); BUFFER *payload=buffer_new();
STRING *str=string_from_char(remotehost); STRING *str=string_from_char(remotehost);
SSH_SESSION *session=channel->session; SSH_SESSION *session=channel->session;
@ -581,7 +582,7 @@ int channel_close(CHANNEL *channel){
* SSH_ERROR on error * SSH_ERROR on error
* \see channel_read() * \see channel_read()
*/ */
int channel_write(CHANNEL *channel, void *data, u32 len) { int channel_write(CHANNEL *channel, const void *data, u32 len) {
SSH_SESSION *session=channel->session; SSH_SESSION *session=channel->session;
int effectivelen; int effectivelen;
int origlen=len; int origlen=len;
@ -675,7 +676,8 @@ void channel_set_blocking(CHANNEL *channel, int blocking){
channel->blocking=blocking; channel->blocking=blocking;
} }
static int channel_request(CHANNEL *channel,char *request, BUFFER *buffer,int reply){ static int channel_request(CHANNEL *channel, const char *request,
BUFFER *buffer, int reply) {
STRING *request_s=string_from_char(request); STRING *request_s=string_from_char(request);
SSH_SESSION *session=channel->session; SSH_SESSION *session=channel->session;
int err; int err;
@ -718,7 +720,8 @@ static int channel_request(CHANNEL *channel,char *request, BUFFER *buffer,int re
* \return SSH_SUCCESS on success\n * \return SSH_SUCCESS on success\n
* SSH_ERROR on error * SSH_ERROR on error
*/ */
int channel_request_pty_size(CHANNEL *channel, char *terminal, int col, int row){ int channel_request_pty_size(CHANNEL *channel, const char *terminal,
int col, int row) {
STRING *term; STRING *term;
BUFFER *buffer; BUFFER *buffer;
SSH_SESSION *session=channel->session; SSH_SESSION *session=channel->session;
@ -811,10 +814,10 @@ int channel_request_shell(CHANNEL *channel){
* \warning you normally don't have to call it to have sftp * \warning you normally don't have to call it to have sftp
* \see sftp_new() * \see sftp_new()
*/ */
int channel_request_subsystem(CHANNEL *channel, char *system){ int channel_request_subsystem(CHANNEL *channel, const char *sys){
BUFFER* buffer=buffer_new(); BUFFER* buffer=buffer_new();
int ret; int ret;
STRING *subsystem=string_from_char(system); STRING *subsystem=string_from_char(sys);
buffer_add_ssh_string(buffer,subsystem); buffer_add_ssh_string(buffer,subsystem);
free(subsystem); free(subsystem);
ret=channel_request(channel,"subsystem",buffer,1); ret=channel_request(channel,"subsystem",buffer,1);
@ -834,7 +837,7 @@ int channel_request_sftp( CHANNEL *channel){
* SSH_ERROR on error * SSH_ERROR on error
* \warning some environement variables may be refused by security * \warning some environement variables may be refused by security
* */ * */
int channel_request_env(CHANNEL *channel,char *name, char *value){ int channel_request_env(CHANNEL *channel, const char *name, const char *value){
BUFFER *buffer=buffer_new(); BUFFER *buffer=buffer_new();
int ret; int ret;
STRING *string=string_from_char(name); STRING *string=string_from_char(name);
@ -856,7 +859,7 @@ int channel_request_env(CHANNEL *channel,char *name, char *value){
* SSH_ERROR on error * SSH_ERROR on error
* \see channel_request_shell() * \see channel_request_shell()
*/ */
int channel_request_exec(CHANNEL *channel, char *cmd){ int channel_request_exec(CHANNEL *channel, const char *cmd) {
BUFFER *buffer; BUFFER *buffer;
STRING *command; STRING *command;
int ret; int ret;

Просмотреть файл

@ -739,8 +739,8 @@ STRING *publickey_from_file(SSH_SESSION *session,char *filename,int *_type){
/* why recursing ? i'll explain. on top, publickey_from_next_file will be executed until NULL returned */ /* why recursing ? i'll explain. on top, publickey_from_next_file will be executed until NULL returned */
/* we can't return null if one of the possible keys is wrong. we must test them before getting over */ /* we can't return null if one of the possible keys is wrong. we must test them before getting over */
STRING *publickey_from_next_file(SSH_SESSION *session,char **pub_keys_path,char **keys_path, STRING *publickey_from_next_file(SSH_SESSION *session, const char **pub_keys_path,
char **privkeyfile,int *type,int *count){ const char **keys_path, char **privkeyfile, int *type, int *count) {
static char *home=NULL; static char *home=NULL;
char public[256]; char public[256];
char private[256]; char private[256];