summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2016-06-05 14:16:36 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2019-07-21 20:59:35 +0100
commit3c34fbcc87e3cb58d27cd104a84143c8d3cb3564 (patch)
tree950d783835d732ccf563bd29bba4bd1a68348026
parent83edbefbaabb2b17c84ac803131dc1a549da6964 (diff)
Add ^ support for SSL connections
-rw-r--r--src/hash.c4
-rw-r--r--src/s_user.c32
2 files changed, 32 insertions, 4 deletions
diff --git a/src/hash.c b/src/hash.c
index 48a20e2..4c8d820 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -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;
/*