Commit 0a468a2b authored by Niels Möller's avatar Niels Möller
Browse files

New function format_service_Request().

Rev: src/service.c:1.6
Rev: src/service.h:1.5
parent 143a17b7
...@@ -35,6 +35,11 @@ struct service_handler ...@@ -35,6 +35,11 @@ struct service_handler
struct alist *services; struct alist *services;
}; };
struct lsh_string *format_service_request(int name)
{
return ssh_format("%c%a", SSH_MSG_SERVICE_REQUEST, name);
}
struct lsh_string *format_service_accept(int name) struct lsh_string *format_service_accept(int name)
{ {
return ssh_format("%c%a", SSH_MSG_SERVICE_ACCEPT, name); return ssh_format("%c%a", SSH_MSG_SERVICE_ACCEPT, name);
...@@ -61,6 +66,8 @@ static int do_service(struct packet_handler *c, ...@@ -61,6 +66,8 @@ static int do_service(struct packet_handler *c,
{ {
struct ssh_service *service; struct ssh_service *service;
lsh_string_free(packet);
if (!name if (!name
|| !(service = ALIST_GET(closure->services, name)) || !(service = ALIST_GET(closure->services, name))
|| !SERVICE_INIT(service, connection)) || !SERVICE_INIT(service, connection))
......
...@@ -27,9 +27,10 @@ ...@@ -27,9 +27,10 @@
#include "alist.h" #include "alist.h"
#include "connection.h" #include "connection.h"
/* Used on both client and server side */ /* Used for both proper services (i.e. services that can be requested
* in a SSH_MSG_SERVICE_REQUEST or SSH_MSG_USERAUTH_REQUEST) and for
* any other stuff that needs initialization at some later time. */.
/* The init function only returns 1 on success, 0 on failure. */
struct ssh_service struct ssh_service
{ {
int (*init)(struct ssh_service *self, struct ssh_connection *c); int (*init)(struct ssh_service *self, struct ssh_connection *c);
...@@ -40,10 +41,11 @@ struct ssh_service ...@@ -40,10 +41,11 @@ struct ssh_service
/* services is an alist mapping names to service objects */ /* services is an alist mapping names to service objects */
struct packet_handler *make_service_handler(struct alist *services); struct packet_handler *make_service_handler(struct alist *services);
struct lsh_string *format_service_request(int name); #if 0
int request_service(int name, struct ssh_service * service); int request_service(int name, struct ssh_service * service);
#endif
struct lsh_string *format_service_request(int name);
struct lsh_string *format_service_accept(int name); struct lsh_string *format_service_accept(int name);
struct ssh_service *make_meta_service(struct alist *services); struct ssh_service *make_meta_service(struct alist *services);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment