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
---
Module: ngircd.git
Branch: master
Commit: 2bacb8210b4f0807eb50587bcc4329c7ea7a50c3
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=2bacb821…
Author: Alexander Barton <alex(a)barton.de>
Date: Mon Aug 26 21:17:10 2013 +0200
Implement new configuration option "DefaultUserModes"
The new configuration option "DefaultUserModes" lists user modes that
become automatically set on new local clients right after login.
Please note that only modes can be set that the client could set on
itself, you can't set "a" (away) or "o" (IRC Op), for example! User
modes "i" (invisible) or "x" (cloaked) etc. are "interesting", though.
Default: set no modes (like without this patch).
Closes bug #160.
---
doc/sample-ngircd.conf.tmpl | 7 ++++++-
man/ngircd.conf.5.tmpl | 6 ++++++
src/ngircd/conf.c | 26 ++++++++++++++++++++++++++
src/ngircd/conf.h | 3 +++
src/ngircd/login.c | 18 ++++++++++++++++--
5 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/doc/sample-ngircd.conf.tmpl b/doc/sample-ngircd.conf.tmpl
index 99960e9..ae1b213 100644
--- a/doc/sample-ngircd.conf.tmpl
+++ b/doc/sample-ngircd.conf.tmpl
@@ -165,7 +165,12 @@
;ConnectIPv6 = yes
;ConnectIPv4 = yes
- # Do any DNS lookups when a client connects to the server.
+ # Default user mode(s) to set on new local clients. Please note that
+ # only modes can be set that the client could set on itself, you can't
+ # set "a" (away) or "o" (IRC Op), for example! Default: none.
+ ;DefaultUserModes = i
+
+ # Do DNS lookups when a client connects to the server.
;DNS = yes
# Do IDENT lookups if ngIRCd has been compiled with support for it.
diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl
index c9d7bf8..cf926f9 100644
--- a/man/ngircd.conf.5.tmpl
+++ b/man/ngircd.conf.5.tmpl
@@ -258,6 +258,12 @@ Set this to no if you do not want ngIRCd to connect to other IRC servers using
the IPv6 protocol.
Default: yes.
.TP
+\fBDefaultUserModes\fR (string)
+Default user mode(s) to set on new local clients. Please note that only modes
+can be set that the client could set on itself, you can't set "a" (away) or
+"o" (IRC Op), for example!
+Default: none.
+.TP
\fBDNS\fR (boolean)
If set to false, ngIRCd will not make any DNS lookups when clients connect.
If you configure the daemon to connect to other servers, ngIRCd may still
diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c
index 79376b8..b10f490 100644
--- a/src/ngircd/conf.c
+++ b/src/ngircd/conf.c
@@ -402,6 +402,7 @@ Conf_Test( void )
printf(" ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6));
printf(" ConnectIPv6 = %s\n", yesno_to_str(Conf_ConnectIPv4));
#endif
+ printf(" DefaultUserModes = %s\n", Conf_DefaultUserModes);
printf(" DNS = %s\n", yesno_to_str(Conf_DNS));
#ifdef IDENT
printf(" Ident = %s\n", yesno_to_str(Conf_Ident));
@@ -776,6 +777,7 @@ Set_Defaults(bool InitServers)
#else
Conf_ConnectIPv6 = false;
#endif
+ strcpy(Conf_DefaultUserModes, "");
Conf_DNS = true;
#ifdef IDENTAUTH
Conf_Ident = true;
@@ -1706,6 +1708,30 @@ Handle_OPTIONS(const char *File, int Line, char *Var, char *Arg)
Conf_ConnectIPv4 = Check_ArgIsTrue(Arg);
return;
}
+ if (strcasecmp(Var, "DefaultUserModes") == 0) {
+ p = Arg;
+ Conf_DefaultUserModes[0] = '\0';
+ while (*p) {
+ if (strchr(Conf_DefaultUserModes, *p)) {
+ /* Mode is already included; ignore it */
+ p++;
+ continue;
+ }
+
+ if (strchr(USERMODES, *p)) {
+ len = strlen(Conf_DefaultUserModes) + 1;
+ assert(len < sizeof(Conf_DefaultUserModes));
+ Conf_DefaultUserModes[len - 1] = *p;
+ Conf_DefaultUserModes[len] = '\0';
+ } else {
+ Config_Error(LOG_WARNING,
+ "%s, line %d: Unknown user mode \"%c\" in \"DefaultUserModes\"!",
+ File, Line, *p);
+ }
+ p++;
+ }
+ return;
+ }
if (strcasecmp(Var, "DNS") == 0) {
Conf_DNS = Check_ArgIsTrue(Arg);
return;
diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h
index 93d6785..948749d 100644
--- a/src/ngircd/conf.h
+++ b/src/ngircd/conf.h
@@ -202,6 +202,9 @@ GLOBAL bool Conf_PAMIsOptional;
/** Disable all CTCP commands except for /me ? */
GLOBAL bool Conf_ScrubCTCP;
+/** Default user modes for new local clients */
+GLOBAL char Conf_DefaultUserModes[CLIENT_MODE_LEN];
+
/*
* try to connect to remote systems using the ipv6 protocol,
* if they have an ipv6 address? (default yes)
diff --git a/src/ngircd/login.c b/src/ngircd/login.c
index bbde635..4011b8b 100644
--- a/src/ngircd/login.c
+++ b/src/ngircd/login.c
@@ -19,6 +19,7 @@
#include "imp.h"
#include <assert.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
@@ -37,6 +38,7 @@
#include "ngircd.h"
#include "pam.h"
#include "irc-info.h"
+#include "irc-mode.h"
#include "irc-write.h"
#include "exp.h"
@@ -151,6 +153,9 @@ Login_User(CLIENT * Client)
GLOBAL bool
Login_User_PostAuth(CLIENT *Client)
{
+ REQUEST Req;
+ char modes[CLIENT_MODE_LEN + 1];
+
assert(Client != NULL);
if (Class_HandleServerBans(Client) != CONNECTED)
@@ -185,8 +190,17 @@ Login_User_PostAuth(CLIENT *Client)
if (!IRC_Show_MOTD(Client))
return DISCONNECTED;
- /* Suspend the client for a second ... */
- IRC_SetPenalty(Client, 1);
+ /* Set default user modes */
+ if (Conf_DefaultUserModes[0]) {
+ snprintf(modes, sizeof(modes), "+%s", Conf_DefaultUserModes);
+ Req.prefix = Client_ThisServer();
+ Req.command = "MODE";
+ Req.argc = 2;
+ Req.argv[0] = Client_ID(Client);
+ Req.argv[1] = modes;
+ IRC_MODE(Client, &Req);
+ } else
+ IRC_SetPenalty(Client, 1);
return CONNECTED;
}
Module: ngircd.git
Branch: master
Commit: 8d01be7bbd2bbfd2524384af3cb9bdefaa87ea48
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=8d01be7b…
Author: Federico G. Schwindt <fgsch(a)lodoss.net>
Date: Sun Aug 25 00:07:06 2013 +0100
Silence warning
Cast the result of the operation to long, not the time(NULL) call.
On systems where sizeof(time_t) is other than long this will produce
a warning.
---
src/ngircd/log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ngircd/log.c b/src/ngircd/log.c
index 028f435..18fb6fa 100644
--- a/src/ngircd/log.c
+++ b/src/ngircd/log.c
@@ -53,7 +53,7 @@ Log_Message(int Level, const char *msg)
if (!Is_Daemon) {
/* log to console */
fprintf(stdout, "[%ld:%d %4ld] %s\n", (long)getpid(), Level,
- (long)time(NULL) - NGIRCd_Start, msg);
+ (long)(time(NULL) - NGIRCd_Start), msg);
fflush(stdout);
}
#ifdef SYSLOG
Module: ngircd.git
Branch: master
Commit: 086cf3a2723e2dcc8e1acf49d166e254fe22e7cf
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=086cf3a2…
Author: Federico G. Schwindt <fgsch(a)lodoss.net>
Date: Sun Aug 25 05:26:08 2013 +0100
Cosmetic changes to METADATA
Update certfp and sort entries.
---
doc/Protocol.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/Protocol.txt b/doc/Protocol.txt
index ae290dd..6b3cfbc 100644
--- a/doc/Protocol.txt
+++ b/doc/Protocol.txt
@@ -225,11 +225,11 @@ new server link", <serverflag> "M"), even if it doesn't support the given
The following <key> names are defined:
- "accountname": the account name of a client (can't be empty)
- - "host": the hostname of a client (can't be empty)
+ - "certfp": the certificate fingerprint of a client (can't be empty)
- "cloakhost": the cloaked hostname of a client
+ - "host": the hostname of a client (can't be empty)
- "info": info text ("real name") of a client
- "user": the user name of a client (can't be empty)
- - "certfp": the cert fingerprint of a client
III. Numerics used by IRC+ Protocol