mirror of
https://github.com/osmarks/ngircd.git
synced 2024-12-12 09:50:29 +00:00
Streamline punctuation of log messages
Make sure that all log messages end with a correct punctuation mark. The rules for formatting log messages are: 1. Add punctuation marks to all messages passed to the actual logging functions like Log() and LogDebug(). 2. Don't add any punctuation marks to messages that are stored in variables for later use or are passed over the network. 3. IP addresses, DNS host names and IRC server names should be quoted. 4. Messages originating in the network should be quoted (at least if they are "untrusted" or variable). Most probably this patch doesn't fix all mistakes, but it should be a good starting point ...
This commit is contained in:
parent
fd260404ca
commit
d38d153f51
@ -131,11 +131,11 @@ Channel_InitPredefined( void )
|
|||||||
|
|
||||||
new_chan = Channel_Create(conf_chan->name);
|
new_chan = Channel_Create(conf_chan->name);
|
||||||
if (!new_chan) {
|
if (!new_chan) {
|
||||||
Log(LOG_ERR, "Can't create pre-defined channel \"%s\"",
|
Log(LOG_ERR, "Can't create pre-defined channel \"%s\"!",
|
||||||
conf_chan->name);
|
conf_chan->name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Log(LOG_INFO, "Created pre-defined channel \"%s\"",
|
Log(LOG_INFO, "Created pre-defined channel \"%s\".",
|
||||||
conf_chan->name);
|
conf_chan->name);
|
||||||
|
|
||||||
Channel_ModeAdd(new_chan, 'P');
|
Channel_ModeAdd(new_chan, 'P');
|
||||||
|
@ -239,9 +239,9 @@ Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool Sen
|
|||||||
|
|
||||||
assert( Client != NULL );
|
assert( Client != NULL );
|
||||||
|
|
||||||
if( LogMsg ) txt = LogMsg;
|
txt = LogMsg ? LogMsg : FwdMsg;
|
||||||
else txt = FwdMsg;
|
if (!txt)
|
||||||
if( ! txt ) txt = "Reason unknown.";
|
txt = "Reason unknown";
|
||||||
|
|
||||||
/* netsplit message */
|
/* netsplit message */
|
||||||
if( Client->type == CLIENT_SERVER ) {
|
if( Client->type == CLIENT_SERVER ) {
|
||||||
@ -281,10 +281,15 @@ Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool Sen
|
|||||||
Destroy_UserOrService(c, txt, FwdMsg, SendQuit);
|
Destroy_UserOrService(c, txt, FwdMsg, SendQuit);
|
||||||
else if( c->type == CLIENT_SERVER )
|
else if( c->type == CLIENT_SERVER )
|
||||||
{
|
{
|
||||||
if( c != This_Server )
|
if (c != This_Server) {
|
||||||
{
|
if (c->conn_id != NONE)
|
||||||
if( c->conn_id != NONE ) Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
|
Log(LOG_NOTICE|LOG_snotice,
|
||||||
else Log( LOG_NOTICE|LOG_snotice, "Server \"%s\" unregistered: %s", c->id, txt );
|
"Server \"%s\" unregistered (connection %d): %s.",
|
||||||
|
c->id, c->conn_id, txt);
|
||||||
|
else
|
||||||
|
Log(LOG_NOTICE|LOG_snotice,
|
||||||
|
"Server \"%s\" unregistered: %s.",
|
||||||
|
c->id, txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inform other servers */
|
/* inform other servers */
|
||||||
@ -296,13 +301,19 @@ Client_Destroy( CLIENT *Client, const char *LogMsg, const char *FwdMsg, bool Sen
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( c->conn_id != NONE )
|
if (c->conn_id != NONE) {
|
||||||
{
|
if (c->id[0])
|
||||||
if( c->id[0] ) Log( LOG_NOTICE, "Client \"%s\" unregistered (connection %d): %s", c->id, c->conn_id, txt );
|
Log(LOG_NOTICE,
|
||||||
else Log( LOG_NOTICE, "Client unregistered (connection %d): %s", c->conn_id, txt );
|
"Client \"%s\" unregistered (connection %d): %s.",
|
||||||
|
c->id, c->conn_id, txt);
|
||||||
|
else
|
||||||
|
Log(LOG_NOTICE,
|
||||||
|
"Client unregistered (connection %d): %s.",
|
||||||
|
c->conn_id, txt);
|
||||||
} else {
|
} else {
|
||||||
Log(LOG_WARNING, "Unregistered unknown client \"%s\": %s",
|
Log(LOG_WARNING,
|
||||||
c->id[0] ? c->id : "(No Nick)", txt );
|
"Unregistered unknown client \"%s\": %s",
|
||||||
|
c->id[0] ? c->id : "(No Nick)", txt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1424,7 +1435,7 @@ Destroy_UserOrService(CLIENT *Client, const char *Txt, const char *FwdMsg, bool
|
|||||||
if(Client->conn_id != NONE) {
|
if(Client->conn_id != NONE) {
|
||||||
/* Local (directly connected) client */
|
/* Local (directly connected) client */
|
||||||
Log(LOG_NOTICE,
|
Log(LOG_NOTICE,
|
||||||
"%s \"%s\" unregistered (connection %d): %s",
|
"%s \"%s\" unregistered (connection %d): %s.",
|
||||||
Client_TypeText(Client), Client_Mask(Client),
|
Client_TypeText(Client), Client_Mask(Client),
|
||||||
Client->conn_id, Txt);
|
Client->conn_id, Txt);
|
||||||
Log_ServerNotice('c', "Client exiting: %s (%s@%s) [%s]",
|
Log_ServerNotice('c', "Client exiting: %s (%s@%s) [%s]",
|
||||||
@ -1442,7 +1453,7 @@ Destroy_UserOrService(CLIENT *Client, const char *Txt, const char *FwdMsg, bool
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Remote client */
|
/* Remote client */
|
||||||
LogDebug("%s \"%s\" unregistered: %s",
|
LogDebug("%s \"%s\" unregistered: %s.",
|
||||||
Client_TypeText(Client), Client_Mask(Client), Txt);
|
Client_TypeText(Client), Client_Mask(Client), Txt);
|
||||||
|
|
||||||
if(SendQuit) {
|
if(SendQuit) {
|
||||||
|
@ -205,7 +205,7 @@ cb_connserver(int sock, UNUSED short what)
|
|||||||
My_Connections[idx].host, Conf_Server[server].port,
|
My_Connections[idx].host, Conf_Server[server].port,
|
||||||
idx, strerror(err));
|
idx, strerror(err));
|
||||||
|
|
||||||
Conn_Close(idx, "Can't connect!", NULL, false);
|
Conn_Close(idx, "Can't connect", NULL, false);
|
||||||
|
|
||||||
if (ng_ipaddr_af(&Conf_Server[server].dst_addr[0])) {
|
if (ng_ipaddr_af(&Conf_Server[server].dst_addr[0])) {
|
||||||
/* more addresses to try... */
|
/* more addresses to try... */
|
||||||
@ -282,7 +282,7 @@ cb_connserver_login_ssl(int sock, short unused)
|
|||||||
return;
|
return;
|
||||||
case -1:
|
case -1:
|
||||||
Log(LOG_ERR, "SSL connection on socket %d failed!", sock);
|
Log(LOG_ERR, "SSL connection on socket %d failed!", sock);
|
||||||
Conn_Close(idx, "Can't connect!", NULL, false);
|
Conn_Close(idx, "Can't connect", NULL, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ InitSinaddrListenAddr(ng_ipaddr_t *addr, const char *listen_addrstr, UINT16 Port
|
|||||||
ret = ng_ipaddr_init(addr, listen_addrstr, Port);
|
ret = ng_ipaddr_init(addr, listen_addrstr, Port);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
assert(listen_addrstr);
|
assert(listen_addrstr);
|
||||||
Log(LOG_CRIT, "Can't bind to [%s]:%u: can't convert ip address \"%s\"",
|
Log(LOG_CRIT, "Can't bind to [%s]:%u: can't convert ip address \"%s\"!",
|
||||||
listen_addrstr, Port, listen_addrstr);
|
listen_addrstr, Port, listen_addrstr);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -631,7 +631,7 @@ NewListener(const char *listen_addr, UINT16 Port)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (bind(sock, (struct sockaddr *)&addr, ng_ipaddr_salen(&addr)) != 0) {
|
if (bind(sock, (struct sockaddr *)&addr, ng_ipaddr_salen(&addr)) != 0) {
|
||||||
Log(LOG_CRIT, "Can't bind socket to address %s:%d - %s",
|
Log(LOG_CRIT, "Can't bind socket to address %s:%d - %s!",
|
||||||
ng_ipaddr_tostr(&addr), Port, strerror(errno));
|
ng_ipaddr_tostr(&addr), Port, strerror(errno));
|
||||||
close(sock);
|
close(sock);
|
||||||
return -1;
|
return -1;
|
||||||
@ -1078,7 +1078,7 @@ Conn_Close( CONN_ID Idx, const char *LogMsg, const char *FwdMsg, bool InformClie
|
|||||||
Conn_OPTION_ADD( &My_Connections[Idx], CONN_ISCLOSING );
|
Conn_OPTION_ADD( &My_Connections[Idx], CONN_ISCLOSING );
|
||||||
|
|
||||||
port = ng_ipaddr_getport(&My_Connections[Idx].addr);
|
port = ng_ipaddr_getport(&My_Connections[Idx].addr);
|
||||||
Log(LOG_INFO, "Shutting down connection %d (%s) with %s:%d ...", Idx,
|
Log(LOG_INFO, "Shutting down connection %d (%s) with \"%s:%d\" ...", Idx,
|
||||||
LogMsg ? LogMsg : FwdMsg, My_Connections[Idx].host, port);
|
LogMsg ? LogMsg : FwdMsg, My_Connections[Idx].host, port);
|
||||||
|
|
||||||
/* Search client, if any */
|
/* Search client, if any */
|
||||||
@ -1152,7 +1152,7 @@ Conn_Close( CONN_ID Idx, const char *LogMsg, const char *FwdMsg, bool InformClie
|
|||||||
in_p = (int)(( in_k * 100 ) / in_z_k );
|
in_p = (int)(( in_k * 100 ) / in_z_k );
|
||||||
out_p = (int)(( out_k * 100 ) / out_z_k );
|
out_p = (int)(( out_k * 100 ) / out_z_k );
|
||||||
Log(LOG_INFO,
|
Log(LOG_INFO,
|
||||||
"Connection %d with %s:%d closed (in: %.1fk/%.1fk/%d%%, out: %.1fk/%.1fk/%d%%).",
|
"Connection %d with \"%s:%d\" closed (in: %.1fk/%.1fk/%d%%, out: %.1fk/%.1fk/%d%%).",
|
||||||
Idx, My_Connections[Idx].host, port,
|
Idx, My_Connections[Idx].host, port,
|
||||||
in_k, in_z_k, in_p, out_k, out_z_k, out_p);
|
in_k, in_z_k, in_p, out_k, out_z_k, out_p);
|
||||||
}
|
}
|
||||||
@ -1160,7 +1160,7 @@ Conn_Close( CONN_ID Idx, const char *LogMsg, const char *FwdMsg, bool InformClie
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
Log(LOG_INFO,
|
Log(LOG_INFO,
|
||||||
"Connection %d with %s:%d closed (in: %.1fk, out: %.1fk).",
|
"Connection %d with \"%s:%d\" closed (in: %.1fk, out: %.1fk).",
|
||||||
Idx, My_Connections[Idx].host, port,
|
Idx, My_Connections[Idx].host, port,
|
||||||
in_k, out_k);
|
in_k, out_k);
|
||||||
}
|
}
|
||||||
@ -1500,7 +1500,7 @@ New_Connection(int Sock, UNUSED bool IsSSL)
|
|||||||
|
|
||||||
Client_SetHostname(c, My_Connections[new_sock].host);
|
Client_SetHostname(c, My_Connections[new_sock].host);
|
||||||
|
|
||||||
Log(LOG_INFO, "Accepted connection %d from %s:%d on socket %d.",
|
Log(LOG_INFO, "Accepted connection %d from \"%s:%d\" on socket %d.",
|
||||||
new_sock, My_Connections[new_sock].host,
|
new_sock, My_Connections[new_sock].host,
|
||||||
ng_ipaddr_getport(&new_addr), Sock);
|
ng_ipaddr_getport(&new_addr), Sock);
|
||||||
Account_Connection();
|
Account_Connection();
|
||||||
@ -1629,13 +1629,10 @@ Read_Request( CONN_ID Idx )
|
|||||||
#endif
|
#endif
|
||||||
len = read(My_Connections[Idx].sock, readbuf, sizeof(readbuf));
|
len = read(My_Connections[Idx].sock, readbuf, sizeof(readbuf));
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
Log(LOG_INFO, "%s:%u (%s) is closing the connection ...",
|
LogDebug("Client \"%s:%u\" is closing connection %d ...",
|
||||||
My_Connections[Idx].host,
|
My_Connections[Idx].host,
|
||||||
(unsigned int) ng_ipaddr_getport(&My_Connections[Idx].addr),
|
ng_ipaddr_tostr(&My_Connections[Idx].addr), Idx);
|
||||||
ng_ipaddr_tostr(&My_Connections[Idx].addr));
|
Conn_Close(Idx, NULL, "Client closed connection", false);
|
||||||
Conn_Close(Idx,
|
|
||||||
"Socket closed!", "Client closed connection",
|
|
||||||
false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1643,7 +1640,7 @@ Read_Request( CONN_ID Idx )
|
|||||||
if( errno == EAGAIN ) return;
|
if( errno == EAGAIN ) return;
|
||||||
Log(LOG_ERR, "Read error on connection %d (socket %d): %s!",
|
Log(LOG_ERR, "Read error on connection %d (socket %d): %s!",
|
||||||
Idx, My_Connections[Idx].sock, strerror(errno));
|
Idx, My_Connections[Idx].sock, strerror(errno));
|
||||||
Conn_Close(Idx, "Read error!", "Client closed connection",
|
Conn_Close(Idx, "Read error", "Client closed connection",
|
||||||
false);
|
false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ io_library_init_kqueue(unsigned int eventsize)
|
|||||||
io_masterfd = kqueue();
|
io_masterfd = kqueue();
|
||||||
|
|
||||||
Log(LOG_INFO,
|
Log(LOG_INFO,
|
||||||
"IO subsystem: kqueue (initial maxfd %u, masterfd %d)",
|
"IO subsystem: kqueue (initial maxfd %u, masterfd %d).",
|
||||||
eventsize, io_masterfd);
|
eventsize, io_masterfd);
|
||||||
if (io_masterfd >= 0)
|
if (io_masterfd >= 0)
|
||||||
library_initialized = true;
|
library_initialized = true;
|
||||||
|
@ -691,11 +691,11 @@ IRC_QUIT( CLIENT *Client, REQUEST *Req )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (target != Client) {
|
if (target != Client) {
|
||||||
Client_Destroy(target, "Got QUIT command.",
|
Client_Destroy(target, "Got QUIT command",
|
||||||
Req->argc == 1 ? quitmsg : NULL, true);
|
Req->argc == 1 ? quitmsg : NULL, true);
|
||||||
return CONNECTED;
|
return CONNECTED;
|
||||||
} else {
|
} else {
|
||||||
Conn_Close(Client_Conn(Client), "Got QUIT command.",
|
Conn_Close(Client_Conn(Client), "Got QUIT command",
|
||||||
Req->argc == 1 ? quitmsg : NULL, true);
|
Req->argc == 1 ? quitmsg : NULL, true);
|
||||||
return DISCONNECTED;
|
return DISCONNECTED;
|
||||||
}
|
}
|
||||||
@ -708,7 +708,7 @@ IRC_QUIT( CLIENT *Client, REQUEST *Req )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* User, Service, or not yet registered */
|
/* User, Service, or not yet registered */
|
||||||
Conn_Close(Client_Conn(Client), "Got QUIT command.",
|
Conn_Close(Client_Conn(Client), "Got QUIT command",
|
||||||
Req->argc == 1 ? quitmsg : NULL, true);
|
Req->argc == 1 ? quitmsg : NULL, true);
|
||||||
|
|
||||||
return DISCONNECTED;
|
return DISCONNECTED;
|
||||||
@ -907,8 +907,9 @@ IRC_PONG(CLIENT *Client, REQUEST *Req)
|
|||||||
|
|
||||||
if (Client_Type(Client) == CLIENT_SERVER && Conn_LastPing(conn) == 0) {
|
if (Client_Type(Client) == CLIENT_SERVER && Conn_LastPing(conn) == 0) {
|
||||||
Log(LOG_INFO,
|
Log(LOG_INFO,
|
||||||
"Synchronization with \"%s\" done (connection %d): %ld seconds [%ld users, %ld channels]",
|
"Synchronization with \"%s\" done (connection %d): %ld second%s [%ld users, %ld channels].",
|
||||||
Client_ID(Client), conn, time(NULL) - Conn_GetSignon(conn),
|
Client_ID(Client), conn, time(NULL) - Conn_GetSignon(conn),
|
||||||
|
time(NULL) - Conn_GetSignon(conn) == 1 ? "" : "s",
|
||||||
Client_UserCount(), Channel_CountVisible(NULL));
|
Client_UserCount(), Channel_CountVisible(NULL));
|
||||||
Conn_UpdatePing(conn);
|
Conn_UpdatePing(conn);
|
||||||
} else
|
} else
|
||||||
@ -938,7 +939,7 @@ Kill_Nick(char *Nick, char *Reason)
|
|||||||
r.argv[1] = Reason;
|
r.argv[1] = Reason;
|
||||||
r.argc = 2;
|
r.argc = 2;
|
||||||
|
|
||||||
Log(LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s",
|
Log(LOG_ERR, "User(s) with nick \"%s\" will be disconnected: %s!",
|
||||||
Nick, Reason);
|
Nick, Reason);
|
||||||
|
|
||||||
IRC_KILL(Client_ThisServer(), &r);
|
IRC_KILL(Client_ThisServer(), &r);
|
||||||
|
@ -352,7 +352,7 @@ IRC_SQUIT(CLIENT * Client, REQUEST * Req)
|
|||||||
|
|
||||||
if (Req->argv[1][0])
|
if (Req->argv[1][0])
|
||||||
if (Client_NextHop(from) != Client || con > NONE)
|
if (Client_NextHop(from) != Client || con > NONE)
|
||||||
snprintf(msg, sizeof(msg), "%s (SQUIT from %s)",
|
snprintf(msg, sizeof(msg), "\"%s\" (SQUIT from %s)",
|
||||||
Req->argv[1], Client_ID(from));
|
Req->argv[1], Client_ID(from));
|
||||||
else
|
else
|
||||||
strlcpy(msg, Req->argv[1], sizeof(msg));
|
strlcpy(msg, Req->argv[1], sizeof(msg));
|
||||||
@ -385,7 +385,7 @@ IRC_SQUIT(CLIENT * Client, REQUEST * Req)
|
|||||||
logmsg[0] = '\0';
|
logmsg[0] = '\0';
|
||||||
if (!strchr(msg, '('))
|
if (!strchr(msg, '('))
|
||||||
snprintf(logmsg, sizeof(logmsg),
|
snprintf(logmsg, sizeof(logmsg),
|
||||||
"%s (SQUIT from %s)", Req->argv[1],
|
"\"%s\" (SQUIT from %s)", Req->argv[1],
|
||||||
Client_ID(from));
|
Client_ID(from));
|
||||||
Client_Destroy(target, logmsg[0] ? logmsg : msg,
|
Client_Destroy(target, logmsg[0] ? logmsg : msg,
|
||||||
msg, false);
|
msg, false);
|
||||||
|
@ -154,7 +154,7 @@ IRC_KILL( CLIENT *Client, REQUEST *Req )
|
|||||||
|
|
||||||
if (Client != Client_ThisServer())
|
if (Client != Client_ThisServer())
|
||||||
Log(LOG_NOTICE|LOG_snotice,
|
Log(LOG_NOTICE|LOG_snotice,
|
||||||
"Got KILL command from \"%s\" for \"%s\": %s",
|
"Got KILL command from \"%s\" for \"%s\": \"%s\".",
|
||||||
Client_Mask(prefix), Req->argv[0], Req->argv[1]);
|
Client_Mask(prefix), Req->argv[0], Req->argv[1]);
|
||||||
|
|
||||||
/* Build reason string: Prefix the "reason" if the originator is a
|
/* Build reason string: Prefix the "reason" if the originator is a
|
||||||
|
@ -535,16 +535,18 @@ Pidfile_Create(pid_t pid)
|
|||||||
|
|
||||||
len = snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid);
|
len = snprintf(pidbuf, sizeof pidbuf, "%ld\n", (long)pid);
|
||||||
if (len < 0 || len >= (int)sizeof pidbuf) {
|
if (len < 0 || len >= (int)sizeof pidbuf) {
|
||||||
Log(LOG_ERR, "Error converting pid");
|
Log(LOG_ERR, "Error converting process ID!");
|
||||||
close(pidfd);
|
close(pidfd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write(pidfd, pidbuf, (size_t)len) != (ssize_t)len)
|
if (write(pidfd, pidbuf, (size_t)len) != (ssize_t)len)
|
||||||
Log( LOG_ERR, "Can't write PID file (%s): %s", Conf_PidFile, strerror( errno ));
|
Log(LOG_ERR, "Can't write PID file (%s): %s!", Conf_PidFile,
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
if( close(pidfd) != 0 )
|
if (close(pidfd) != 0)
|
||||||
Log( LOG_ERR, "Error closing PID file (%s): %s", Conf_PidFile, strerror( errno ));
|
Log(LOG_ERR, "Error closing PID file (%s): %s!", Conf_PidFile,
|
||||||
|
strerror(errno));
|
||||||
} /* Pidfile_Create */
|
} /* Pidfile_Create */
|
||||||
|
|
||||||
|
|
||||||
@ -678,14 +680,14 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
|
|||||||
/* Change root */
|
/* Change root */
|
||||||
if (Conf_Chroot[0]) {
|
if (Conf_Chroot[0]) {
|
||||||
if (chdir(Conf_Chroot) != 0) {
|
if (chdir(Conf_Chroot) != 0) {
|
||||||
Log(LOG_ERR, "Can't chdir() in ChrootDir (%s): %s",
|
Log(LOG_ERR, "Can't chdir() in ChrootDir (%s): %s!",
|
||||||
Conf_Chroot, strerror(errno));
|
Conf_Chroot, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chroot(Conf_Chroot) != 0) {
|
if (chroot(Conf_Chroot) != 0) {
|
||||||
Log(LOG_ERR,
|
Log(LOG_ERR,
|
||||||
"Can't change root directory to \"%s\": %s",
|
"Can't change root directory to \"%s\": %s!",
|
||||||
Conf_Chroot, strerror(errno));
|
Conf_Chroot, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
@ -716,7 +718,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
|
|||||||
if (setgid(Conf_GID) != 0) {
|
if (setgid(Conf_GID) != 0) {
|
||||||
real_errno = errno;
|
real_errno = errno;
|
||||||
grp = getgrgid(Conf_GID);
|
grp = getgrgid(Conf_GID);
|
||||||
Log(LOG_ERR, "Can't change group ID to %s(%u): %s",
|
Log(LOG_ERR, "Can't change group ID to %s(%u): %s!",
|
||||||
grp ? grp->gr_name : "?", Conf_GID,
|
grp ? grp->gr_name : "?", Conf_GID,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
if (real_errno != EPERM)
|
if (real_errno != EPERM)
|
||||||
@ -730,7 +732,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
|
|||||||
if (setuid(Conf_UID) != 0) {
|
if (setuid(Conf_UID) != 0) {
|
||||||
real_errno = errno;
|
real_errno = errno;
|
||||||
pwd = getpwuid(Conf_UID);
|
pwd = getpwuid(Conf_UID);
|
||||||
Log(LOG_ERR, "Can't change user ID to %s(%u): %s",
|
Log(LOG_ERR, "Can't change user ID to %s(%u): %s!",
|
||||||
pwd ? pwd->pw_name : "?", Conf_UID,
|
pwd ? pwd->pw_name : "?", Conf_UID,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
if (real_errno != EPERM)
|
if (real_errno != EPERM)
|
||||||
@ -764,7 +766,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
|
|||||||
setpgrp(0, getpid());
|
setpgrp(0, getpid());
|
||||||
#endif
|
#endif
|
||||||
if (chdir("/") != 0)
|
if (chdir("/") != 0)
|
||||||
Log(LOG_ERR, "Can't change directory to '/': %s",
|
Log(LOG_ERR, "Can't change directory to '/': %s!",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
|
||||||
/* Detach stdin, stdout and stderr */
|
/* Detach stdin, stdout and stderr */
|
||||||
@ -808,7 +810,7 @@ NGIRCd_Init(bool NGIRCd_NoDaemon)
|
|||||||
pwd->pw_dir);
|
pwd->pw_dir);
|
||||||
else
|
else
|
||||||
Log(LOG_INFO,
|
Log(LOG_INFO,
|
||||||
"Notice: Can't change working directory to \"%s\": %s",
|
"Notice: Can't change working directory to \"%s\": %s!",
|
||||||
pwd->pw_dir, strerror(errno));
|
pwd->pw_dir, strerror(errno));
|
||||||
} else
|
} else
|
||||||
Log(LOG_ERR, "Can't get user informaton for UID %d!?", Conf_UID);
|
Log(LOG_ERR, "Can't get user informaton for UID %d!?", Conf_UID);
|
||||||
|
Loading…
Reference in New Issue
Block a user