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>2016-06-05 17:47:56 +0100
commit52f2f768af8fbc251924c510eecb87f16b6af5bb (patch)
treee5d85ce2167845981b9ec15dafaad39fa0717f53
parentbdc20e81e628a5d630f649b2d01fcfc795ca39ea (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 b9a9a64..1017c05 100644
--- a/src/s_user.c
+++ b/src/s_user.c
@@ -339,8 +339,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 != '[')
@@ -348,6 +354,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))
@@ -674,7 +702,7 @@ valid_username(const char *username, const int local)
assert(p != NULL);
- if (*p == '~')
+ if (*p == '^' || *p == '~')
++p;
/*