aboutsummaryrefslogtreecommitdiff
path: root/src/messages.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-09-25 15:54:30 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-10-24 09:48:35 +0200
commit54ec81db2dd653a83a7d975a6d38132fc8f1d8c7 (patch)
tree1d27c2c4c40bba2bd95425a5ef1a588ecb6d3fe5 /src/messages.c
parent1ec2ca420226c8f8f2fdd1b249944d0be62eeda3 (diff)
downloadlibssh-54ec81db2dd653a83a7d975a6d38132fc8f1d8c7.tar.gz
libssh-54ec81db2dd653a83a7d975a6d38132fc8f1d8c7.tar.xz
libssh-54ec81db2dd653a83a7d975a6d38132fc8f1d8c7.zip
messages: Reformat ssh_packet_service_request()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/messages.c')
-rw-r--r--src/messages.c63
1 files changed, 35 insertions, 28 deletions
diff --git a/src/messages.c b/src/messages.c
index c225a80c..282698e5 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -611,38 +611,45 @@ void ssh_message_free(ssh_message msg){
#ifdef WITH_SERVER
-SSH_PACKET_CALLBACK(ssh_packet_service_request){
- ssh_string service = NULL;
- char *service_c = NULL;
- ssh_message msg=NULL;
+SSH_PACKET_CALLBACK(ssh_packet_service_request)
+{
+ ssh_string service = NULL;
+ char *service_c = NULL;
+ ssh_message msg = NULL;
- (void)type;
- (void)user;
- service = ssh_buffer_get_ssh_string(packet);
- if (service == NULL) {
- ssh_set_error(session, SSH_FATAL, "Invalid SSH_MSG_SERVICE_REQUEST packet");
- goto error;
- }
+ (void)type;
+ (void)user;
- service_c = ssh_string_to_char(service);
- if (service_c == NULL) {
- goto error;
- }
- SSH_LOG(SSH_LOG_PACKET,
- "Received a SERVICE_REQUEST for service %s", service_c);
- msg=ssh_message_new(session);
- if(!msg){
- SAFE_FREE(service_c);
- goto error;
- }
- msg->type=SSH_REQUEST_SERVICE;
- msg->service_request.service=service_c;
+ service = ssh_buffer_get_ssh_string(packet);
+ if (service == NULL) {
+ ssh_set_error(session,
+ SSH_FATAL,
+ "Invalid SSH_MSG_SERVICE_REQUEST packet");
+ goto error;
+ }
+
+ service_c = ssh_string_to_char(service);
+ if (service_c == NULL) {
+ goto error;
+ }
+ SSH_LOG(SSH_LOG_PACKET,
+ "Received a SERVICE_REQUEST for service %s",
+ service_c);
+ msg = ssh_message_new(session);
+ if (msg == NULL) {
+ SAFE_FREE(service_c);
+ goto error;
+ }
+
+ msg->type=SSH_REQUEST_SERVICE;
+ msg->service_request.service=service_c;
error:
- ssh_string_free(service);
- if(msg != NULL)
- ssh_message_queue(session,msg);
+ ssh_string_free(service);
+ if (msg != NULL) {
+ ssh_message_queue(session, msg);
+ }
- return SSH_PACKET_USED;
+ return SSH_PACKET_USED;
}