mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 01:26:58 +00:00
add support for user level auth to esl and fs_cli
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16161 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -580,7 +580,7 @@ ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_list
|
||||
|
||||
}
|
||||
|
||||
ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password)
|
||||
ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *user, const char *password)
|
||||
{
|
||||
|
||||
struct hostent *result;
|
||||
@@ -651,7 +651,12 @@ ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, es
|
||||
goto fail;
|
||||
}
|
||||
|
||||
snprintf(sendbuf, sizeof(sendbuf), "auth %s\n\n", password);
|
||||
if (esl_strlen_zero(user)) {
|
||||
snprintf(sendbuf, sizeof(sendbuf), "auth %s\n\n", password);
|
||||
} else {
|
||||
snprintf(sendbuf, sizeof(sendbuf), "userauth %s:%s\n\n", user, password);
|
||||
}
|
||||
|
||||
esl_send(handle, sendbuf);
|
||||
|
||||
|
||||
|
@@ -14,7 +14,15 @@ ESLconnection::ESLconnection(const char *host, const char *port, const char *pas
|
||||
connection_construct_common();
|
||||
int x_port = atoi(port);
|
||||
|
||||
esl_connect(&handle, host, x_port, password);
|
||||
esl_connect(&handle, host, x_port, NULL, password);
|
||||
}
|
||||
|
||||
ESLconnection::ESLconnection(const char *host, const char *port, const char *user, const char *password)
|
||||
{
|
||||
connection_construct_common();
|
||||
int x_port = atoi(port);
|
||||
|
||||
esl_connect(&handle, host, x_port, user, password);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -379,9 +379,10 @@ ESL_DECLARE(esl_status_t) esl_sendevent(esl_handle_t *handle, esl_event_t *event
|
||||
\param handle Handle to connect
|
||||
\param host Host to be connected
|
||||
\param port Port to be connected
|
||||
\param password FreeSWITCH server username (optional)
|
||||
\param password FreeSWITCH server password
|
||||
*/
|
||||
ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password);
|
||||
ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *user, const char *password);
|
||||
/*!
|
||||
\brief Disconnect a handle
|
||||
\param handle Handle to be disconnected
|
||||
|
@@ -72,6 +72,7 @@ class ESLconnection {
|
||||
private:
|
||||
esl_handle_t handle;
|
||||
public:
|
||||
ESLconnection(const char *host, const char *port, const char *user, const char *password);
|
||||
ESLconnection(const char *host, const char *port, const char *password);
|
||||
ESLconnection(int socket);
|
||||
virtual ~ESLconnection();
|
||||
|
Reference in New Issue
Block a user