summaryrefslogtreecommitdiffstats
path: root/libssh/messages.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-04-09 11:07:31 +0000
committerAndreas Schneider <mail@cynapses.org>2009-04-09 11:07:31 +0000
commit3fab89b22fb1c39865ab6b71ab79d663923e724f (patch)
tree38e97ac946fb1c07fa2093ec9fcdb734ebd4c2e0 /libssh/messages.c
parent61bee4c60c15f0db3797c5495dda85c3c8f4cad6 (diff)
downloadlibssh-3fab89b22fb1c39865ab6b71ab79d663923e724f.tar.gz
libssh-3fab89b22fb1c39865ab6b71ab79d663923e724f.tar.xz
libssh-3fab89b22fb1c39865ab6b71ab79d663923e724f.zip
Improve ssh_message_auth* functions.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@442 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/messages.c')
-rw-r--r--libssh/messages.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/libssh/messages.c b/libssh/messages.c
index 1fdf685..65d9550 100644
--- a/libssh/messages.c
+++ b/libssh/messages.c
@@ -211,16 +211,30 @@ error:
return NULL;
}
-char *ssh_message_auth_user(SSH_MESSAGE *msg){
- return msg->auth_request.username;
+char *ssh_message_auth_user(SSH_MESSAGE *msg) {
+ if (msg == NULL || msg->auth_request == NULL) {
+ return NULL;
+ }
+
+ return msg->auth_request.username;
}
char *ssh_message_auth_password(SSH_MESSAGE *msg){
- return msg->auth_request.password;
+ if (msg == NULL || msg->auth_request == NULL) {
+ return NULL;
+ }
+
+ return msg->auth_request.password;
}
-void ssh_message_auth_set_methods(SSH_MESSAGE *msg,int methods){
- msg->session->auth_methods=methods;
+int ssh_message_auth_set_methods(SSH_MESSAGE *msg, int methods) {
+ if (msg == NULL || msg->session == NULL) {
+ return -1;
+ }
+
+ msg->session->auth_methods = methods;
+
+ return 0;
}
static int ssh_message_auth_reply_default(SSH_MESSAGE *msg,int partial){