diff options
Diffstat (limited to 'src/s_user.c')
-rw-r--r-- | src/s_user.c | 32 |
1 files changed, 30 insertions, 2 deletions
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; /* |