Module: ngircd.git
Branch: master
Commit: aad92ceafe8b4b0091867415504f83930a74428b
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=aad92cea…
Author: Alexander Barton <alex(a)barton.de>
Date: Tue Sep 3 17:13:46 2013 +0200
Don't enforce channel types for other servers
The configuration option "AllowedChannelTypes" must only be enforced for
regular clients and not for remote servers. Channels created by other
servres are always allowed, because they already exist and the daemon
must stay in sync with the network.
---
src/ngircd/irc-channel.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c
index 78332ea..4bd5a9d 100644
--- a/src/ngircd/irc-channel.c
+++ b/src/ngircd/irc-channel.c
@@ -341,12 +341,6 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
}
chan = Channel_Search(channame);
- if (!chan && !strchr(Conf_AllowedChannelTypes, channame[0])) {
- /* channel must be created, but forbidden by config */
- IRC_WriteErrClient(Client, ERR_NOSUCHCHANNEL_MSG,
- Client_ID(Client), channame);
- goto join_next;
- }
/* Local client? */
if (Client_Type(Client) == CLIENT_USER) {
@@ -354,6 +348,15 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
/* Already existing channel: already member? */
if (Channel_IsMemberOf(chan, Client))
goto join_next;
+ } else {
+ /* Channel must be created */
+ if (!strchr(Conf_AllowedChannelTypes, channame[0])) {
+ /* ... but channel type is not allowed! */
+ IRC_WriteErrClient(Client,
+ ERR_NOSUCHCHANNEL_MSG,
+ Client_ID(Client), channame);
+ goto join_next;
+ }
}
/* Test if the user has reached the channel limit */
Module: ngircd.git
Branch: master
Commit: 4102e8fdfea33a5d8c398c98db90914c5dc29610
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=4102e8fd…
Author: Alexander Barton <alex(a)barton.de>
Date: Mon Sep 2 16:37:50 2013 +0200
Only log "IDENT ... no result" when IDENT was looked up
Without this patch, ngIRCd logged the "IDENT lookup for connection X:
no result"-message even when IDENT lookups have been disabled using the
"Ident = no" configuration option, which is a little bit misleading.
Reported by "btwe" in #ngircd.
---
src/ngircd/conn.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 8d72c1c..3b09278 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -2454,9 +2454,9 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events )
*ptr ? "" : ": ",
*ptr ? "" : identptr);
}
- } else {
+ } else if(Conf_Ident) {
Log(LOG_INFO, "IDENT lookup for connection %d: no result.", i);
- if (Conf_NoticeAuth && Conf_Ident)
+ if (Conf_NoticeAuth)
(void)Conn_WriteStr(i,
"NOTICE AUTH :*** No ident response");
}
Module: ngircd.git
Branch: master
Commit: 41f75b69740bd205864bd34afbb65ab0a3776136
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=41f75b69…
Author: Alexander Barton <alex(a)barton.de>
Date: Tue Aug 27 00:39:59 2013 +0200
Ignore "operation not permitted" while dropping groups
Without this exception, you can't start ngIRCd as user any more,
it is analog to setting the user and group ID.
---
src/ngircd/ngircd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/ngircd/ngircd.c b/src/ngircd/ngircd.c
index 4099719..e26ac3b 100644
--- a/src/ngircd/ngircd.c
+++ b/src/ngircd/ngircd.c
@@ -725,9 +725,11 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
goto out;
}
if (setgroups(0, NULL) != 0) {
- Log(LOG_ERR, "Can't drop supplementary group ids: %s!",
+ real_errno = errno;
+ Log(LOG_ERR, "Can't drop supplementary group IDs: %s!",
strerror(errno));
- goto out;
+ if (real_errno != EPERM)
+ goto out;
}
}
#endif
Module: ngircd.git
Branch: master
Commit: 1dc93286a0d5b80259604b4f25021fcc5a730b5b
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=1dc93286…
Author: Alexander Barton <alex(a)barton.de>
Date: Mon Aug 26 22:54:00 2013 +0200
Save client IP address text for "WebIRC" users
This patch introduces a new field in the CLIENT structure, "ipa_text",
which points to an optional textual representation of the client IP
address (or NULL) which can be used to store the "real" IP address
information of a client using the "WEBIRC" protocol.
Without this patch, ngIRCd ignored the <ip-address> paramater ...
In addition, the functions Client_SetIPAText() and Client_IPAText()
have been introduced to set and get the textual representation of the
client IP address.
Client_IPAText() can be used even when no "IP address text" has been
set before, it then returns the real IP address of the connection.
Closes bug #159.
---
src/ngircd/client.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/ngircd/client.h | 5 ++++-
src/ngircd/irc-info.c | 4 ++--
src/ngircd/irc-login.c | 2 ++
4 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/src/ngircd/client.c b/src/ngircd/client.c
index 72774ca..26d4929 100644
--- a/src/ngircd/client.c
+++ b/src/ngircd/client.c
@@ -128,6 +128,8 @@ Client_Exit( void )
free(c->account_name);
if (c->cloaked)
free(c->cloaked);
+ if (c->ipa_text)
+ free(c->ipa_text);
free( c );
c = next;
}
@@ -326,6 +328,8 @@ Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool Sen
free(c->account_name);
if (c->cloaked)
free(c->cloaked);
+ if (c->ipa_text)
+ free(c->ipa_text);
free( c );
break;
}
@@ -368,6 +372,27 @@ Client_SetHostname( CLIENT *Client, const char *Hostname )
} /* Client_SetHostname */
+/**
+ * Set IP address to display for a client.
+ *
+ * @param Client The client.
+ * @param IPAText Textual representation of the IP address or NULL to unset.
+ */
+GLOBAL void
+Client_SetIPAText(CLIENT *Client, const char *IPAText)
+{
+ assert(Client != NULL);
+
+ if (Client->ipa_text)
+ free(Client->ipa_text);
+
+ if (*IPAText)
+ Client->ipa_text = strndup(IPAText, CLIENT_HOST_LEN - 1);
+ else
+ Client->ipa_text = NULL;
+}
+
+
GLOBAL void
Client_SetID( CLIENT *Client, const char *ID )
{
@@ -789,6 +814,21 @@ Client_HostnameDisplayed(CLIENT *Client)
return Client->cloaked;
}
+GLOBAL const char *
+Client_IPAText(CLIENT *Client)
+{
+ assert(Client != NULL);
+
+ /* Not a local client? */
+ if (Client_Conn(Client) <= NONE)
+ return "0.0.0.0";
+
+ if (!Client->ipa_text)
+ return Conn_GetIPAInfo(Client_Conn(Client));
+ else
+ return Client->ipa_text;
+}
+
/**
* Update (and generate, if necessary) the cloaked hostname of a client.
*
diff --git a/src/ngircd/client.h b/src/ngircd/client.h
index 702f114..71d413b 100644
--- a/src/ngircd/client.h
+++ b/src/ngircd/client.h
@@ -1,6 +1,6 @@
/*
* ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex(a)barton.de)
+ * Copyright (c)2001-2013 Alexander Barton (alex(a)barton.de) and Contributors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -49,6 +49,7 @@ typedef struct _CLIENT
struct _CLIENT *topserver; /* toplevel servers (only valid if client is a server) */
char host[CLIENT_HOST_LEN]; /* hostname of the client */
char *cloaked; /* cloaked hostname of the client */
+ char *ipa_text; /* textual representaton of IP address */
char user[CLIENT_USER_LEN]; /* user name ("login") */
#if defined(PAM) && defined(IDENTAUTH)
char orig_user[CLIENT_USER_LEN];/* user name supplied by USER command */
@@ -114,6 +115,7 @@ GLOBAL char *Client_OrigUser PARAMS(( CLIENT *Client ));
GLOBAL char *Client_Hostname PARAMS(( CLIENT *Client ));
GLOBAL char *Client_HostnameCloaked PARAMS((CLIENT *Client));
GLOBAL char *Client_HostnameDisplayed PARAMS(( CLIENT *Client ));
+GLOBAL const char *Client_IPAText PARAMS(( CLIENT *Client ));
GLOBAL char *Client_Modes PARAMS(( CLIENT *Client ));
GLOBAL char *Client_Flags PARAMS(( CLIENT *Client ));
GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client ));
@@ -131,6 +133,7 @@ GLOBAL bool Client_HasMode PARAMS(( CLIENT *Client, char Mode ));
GLOBAL bool Client_HasFlag PARAMS(( CLIENT *Client, char Flag ));
GLOBAL void Client_SetHostname PARAMS(( CLIENT *Client, const char *Hostname ));
+GLOBAL void Client_SetIPAText PARAMS(( CLIENT *Client, const char *IPAText ));
GLOBAL void Client_SetID PARAMS(( CLIENT *Client, const char *Nick ));
GLOBAL void Client_SetUser PARAMS(( CLIENT *Client, const char *User, bool Idented ));
GLOBAL void Client_SetOrigUser PARAMS(( CLIENT *Client, const char *User ));
diff --git a/src/ngircd/irc-info.c b/src/ngircd/irc-info.c
index 47a3797..3d77237 100644
--- a/src/ngircd/irc-info.c
+++ b/src/ngircd/irc-info.c
@@ -407,8 +407,8 @@ IRC_WHOIS_SendReply(CLIENT *Client, CLIENT *from, CLIENT *c)
(from == c || (!Conf_MorePrivacy && Client_HasMode(from, 'o')))) {
/* Client hostname */
if (!IRC_WriteStrClient(from, RPL_WHOISHOST_MSG,
- Client_ID(from), Client_ID(c), Client_Hostname(c),
- Conn_GetIPAInfo(Client_Conn(c))))
+ Client_ID(from), Client_ID(c),
+ Client_Hostname(c), Client_IPAText(c)))
return DISCONNECTED;
/* Client modes */
if (!IRC_WriteStrClient(from, RPL_WHOISMODES_MSG,
diff --git a/src/ngircd/irc-login.c b/src/ngircd/irc-login.c
index 26dae6b..88804ef 100644
--- a/src/ngircd/irc-login.c
+++ b/src/ngircd/irc-login.c
@@ -610,6 +610,8 @@ IRC_WEBIRC(CLIENT *Client, REQUEST *Req)
Client_SetUser(Client, Req->argv[1], true);
Client_SetOrigUser(Client, Req->argv[1]);
Client_SetHostname(Client, Req->argv[2]);
+ Client_SetIPAText(Client, Req->argv[3]);
+
return CONNECTED;
} /* IRC_WEBIRC */
Module: ngircd.git
Branch: master
Commit: 44698e44e8a9bf9f3a1211e10b4d59e00be5864f
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=44698e44…
Author: Alexander Barton <alex(a)barton.de>
Date: Mon Aug 26 23:22:20 2013 +0200
Merge branch 'bug159-WebircIPA'
* bug159-WebircIPA:
Introduce Free_Client() function to free CLIENT structure
Save client IP address text for "WebIRC" users
---