diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2016-06-05 14:16:36 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2019-07-21 20:59:35 +0100 |
commit | 3c34fbcc87e3cb58d27cd104a84143c8d3cb3564 (patch) | |
tree | 950d783835d732ccf563bd29bba4bd1a68348026 | |
parent | 83edbefbaabb2b17c84ac803131dc1a549da6964 (diff) |
Add ^ support for SSL connections
-rw-r--r-- | src/hash.c | 4 | ||||
-rw-r--r-- | src/s_user.c | 32 |
2 files changed, 32 insertions, 4 deletions
@@ -569,7 +569,7 @@ add_user_host(const char *user, const char *host, int global) struct NameHost *nameh; int hasident = 1; - if (*user == '~') + if (*user == '~' || *user == '^') { hasident = 0; ++user; @@ -629,7 +629,7 @@ delete_user_host(const char *user, const char *host, int global) struct NameHost *nameh; int hasident = 1; - if (*user == '~') + if (*user == '~' || *user == '^') { hasident = 0; ++user; diff --git a/src/s_user.c b/src/s_user.c index d89038f..b47acd3 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -337,8 +337,14 @@ register_local_user(struct Client *source_p) strlcpy(username, source_p->username, sizeof(username)); - if (!IsNoTilde(conf)) + if (!IsNoTilde(conf)) { +#ifdef HAVE_LIBCRYPTO + if (source_p->localClient->fd.ssl != NULL) + source_p->username[i++] = '^'; + else +#endif source_p->username[i++] = '~'; + } for (; *p && i < USERLEN; ++p) if (*p != '[') @@ -346,6 +352,28 @@ register_local_user(struct Client *source_p) source_p->username[i] = '\0'; } + else + { + char username[USERLEN + 1]; + const char *p = username; + unsigned int i = 0; + + strlcpy(username, source_p->username, sizeof(username)); + + if (!IsNoTilde(conf)) { +#ifdef HAVE_LIBCRYPTO + if (source_p->localClient->fd.ssl != NULL) + source_p->username[i++] = '^'; + else +#endif + source_p->username[i++] = '~'; + } + + for (; *p && i < USERLEN; ++p) + source_p->username[i++] = *p; + + source_p->username[i] = '\0'; + } /* password check */ if (!EmptyString(conf->passwd)) @@ -672,7 +700,7 @@ valid_username(const char *username, const int local) assert(p != NULL); - if (*p == '~') + if (*p == '^' || *p == '~') ++p; /* |