commit - 4cf65b973c780880047b0ad4e77e95cf7315cb0f
commit + 0d5de60584f094ef3b7c27806d6cd7f79e861d7b
blob - 49e273950ea6aeb955e909b1764021970b4fe982
blob + 5ca99c03570c20b97bb92ab40b58f0c82c6f5f27
--- src/ngircd/client.c
+++ src/ngircd/client.c
strlcpy(Client->flags, Flags, sizeof(Client->flags));
} /* Client_SetFlags */
-
-
-GLOBAL void
-Client_SetPassword( CLIENT *Client, const char *Pwd )
-{
- /* set password sent by client */
-
- assert( Client != NULL );
- assert( Pwd != NULL );
-
- strlcpy(Client->pwd, Pwd, sizeof(Client->pwd));
-} /* Client_SetPassword */
GLOBAL void
GLOBAL char *
-Client_Password( CLIENT *Client )
-{
- assert( Client != NULL );
- return Client->pwd;
-} /* Client_Password */
-
-
-GLOBAL char *
Client_Modes( CLIENT *Client )
{
assert( Client != NULL );
blob - 4dbcc7a072232eacfe7cf45020cd2136fb774eb2
blob + 16b2a61ab8564808ad6c58066898602e30431cab
--- src/ngircd/client.h
+++ src/ngircd/client.h
CONN_ID conn_id; /* ID of the connection (if local) or NONE (remote) */
struct _CLIENT *introducer; /* ID of the servers which the client is connected to */
struct _CLIENT *topserver; /* toplevel servers (only valid if client is a server) */
- char pwd[CLIENT_PASS_LEN]; /* password received of the client */
char host[CLIENT_HOST_LEN]; /* hostname of the client */
char user[CLIENT_USER_LEN]; /* user name ("login") */
#if defined(PAM) && defined(IDENTAUTH)
#endif
GLOBAL char *Client_Hostname PARAMS(( CLIENT *Client ));
GLOBAL char *Client_HostnameCloaked PARAMS(( CLIENT *Client ));
-GLOBAL char *Client_Password PARAMS(( CLIENT *Client ));
GLOBAL char *Client_Modes PARAMS(( CLIENT *Client ));
GLOBAL char *Client_Flags PARAMS(( CLIENT *Client ));
GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client ));
GLOBAL void Client_SetUser PARAMS(( CLIENT *Client, const char *User, bool Idented ));
GLOBAL void Client_SetOrigUser PARAMS(( CLIENT *Client, const char *User ));
GLOBAL void Client_SetInfo PARAMS(( CLIENT *Client, const char *Info ));
-GLOBAL void Client_SetPassword PARAMS(( CLIENT *Client, const char *Pwd ));
GLOBAL void Client_SetType PARAMS(( CLIENT *Client, int Type ));
GLOBAL void Client_SetHops PARAMS(( CLIENT *Client, int Hops ));
GLOBAL void Client_SetToken PARAMS(( CLIENT *Client, int Token ));
blob - 06236fd43e2ab1269e91e1065efa11786da0ed40
blob + 4900d7b803361737de363240867cfec6e001c0df
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
va_end( ap );
return ok;
} /* Conn_WriteStr */
+
+GLOBAL const char*
+Conn_Password( CONN_ID Idx )
+{
+ assert( Idx > NONE );
+ return My_Connections[Idx].pwd;
+} /* Conn_Password */
+GLOBAL void
+Conn_SetPassword( CONN_ID Idx, const char *Pwd )
+{
+ assert( Idx > NONE );
+ strlcpy( My_Connections[Idx].pwd, Pwd,
+ sizeof(My_Connections[Idx].pwd) );
+} /* Conn_SetPassword */
/**
* Append Data to the outbound write buffer of a connection.
blob - 4752ec1ede359ee4764066d0b80b578599ff6b74
blob + 9ee979f2da4502ed28e00222b610c201880f6d43
--- src/ngircd/conn.h
+++ src/ngircd/conn.h
ng_ipaddr_t addr; /* Client address */
PROC_STAT proc_stat; /* Status of resolver process */
char host[HOST_LEN]; /* Hostname */
+ char pwd[CLIENT_PASS_LEN]; /* password received of the client */
array rbuf; /* Read buffer */
array wbuf; /* Write buffer */
time_t signon; /* Signon ("connect") time */
GLOBAL bool Conn_WriteStr PARAMS(( CONN_ID Idx, const char *Format, ... ));
+GLOBAL const char* Conn_Password PARAMS(( CONN_ID Idx ));
+GLOBAL void Conn_SetPassword PARAMS(( CONN_ID Idx, const char *Pwd ));
+
GLOBAL void Conn_Close PARAMS(( CONN_ID Idx, const char *LogMsg, const char *FwdMsg, bool InformClient ));
GLOBAL void Conn_SyncServerStruct PARAMS(( void ));
blob - 3fb1b902412118e2cad5b58bcae8af0dacec6379
blob + 9e1abdd59e8b0349b535b9b1299989f994a3827c
--- src/ngircd/irc-login.c
+++ src/ngircd/irc-login.c
Client_ID(Client));
}
- Client_SetPassword(Client, Req->argv[0]);
+ Conn_SetPassword(Client_Conn(Client), Req->argv[0]);
/* Protocol version */
if (Req->argc >= 2 && strlen(Req->argv[1]) >= 4) {
blob - cca295ac831dc486675f08778ec3d0de881a63ea
blob + 5d5ee634a42772f1979d79d56bc6ed8d4f4430f4
--- src/ngircd/irc-server.c
+++ src/ngircd/irc-server.c
Conn_Close( Client_Conn( Client ), NULL, "Server not configured here", true);
return DISCONNECTED;
}
- if( strcmp( Client_Password( Client ), Conf_Server[i].pwd_in ) != 0 )
+ if( strcmp( Conn_Password( Client_Conn( Client ) ), Conf_Server[i].pwd_in ) != 0 )
{
/* wrong password */
Log( LOG_ERR, "Connection %d: Got bad password from server \"%s\"!", Client_Conn( Client ), Req->argv[0] );
blob - 7f0299cb09088622b03787a7815950db772f02c7
blob + e1959d6662adefe11ef91ba351698203bbfcde63
--- src/ngircd/login.c
+++ src/ngircd/login.c
* the beahiour of the daemon compiled without PAM support:
* because there can't be any "server password", all
* passwords supplied are classified as "wrong". */
- if(Client_Password(Client)[0] == '\0')
+ if(Conn_Password(Client_Conn(Client))[0] == '\0')
return Login_User_PostAuth(Client);
Client_Reject(Client, "Non-empty password", false);
return DISCONNECTED;
}
- if (Conf_PAMIsOptional && strcmp(Client_Password(Client), "") == 0) {
+ if (Conf_PAMIsOptional &&
+ strcmp(Conn_Password(Client_Conn(Client)), "") == 0) {
/* Clients are not required to send a password and to be PAM-
* authenticated at all. If not, they won't become "identified"
* and keep the "~" in their supplied user name.
}
#else
/* Check global server password ... */
- if (strcmp(Client_Password(Client), Conf_ServerPwd) != 0) {
+ if (strcmp(Conn_Password(Client_Conn(Client)), Conf_ServerPwd) != 0) {
/* Bad password! */
Client_Reject(Client, "Bad server password", false);
return DISCONNECTED;
blob - 6382c594db0747f5872b7042cb553713d3abd4f1
blob + 88872c47c5f841d9b008da5fdc59a39281f4f2bb
--- src/ngircd/pam.c
+++ src/ngircd/pam.c
/* Set supplied client password */
if (password)
free(password);
- password = strdup(Client_Password(Client));
- conv.appdata_ptr = Client_Password(Client);
+ password = strdup(Conn_Password(Client_Conn(Client)));
+ conv.appdata_ptr = Conn_Password(Client_Conn(Client));
/* Initialize PAM */
retval = pam_start("ngircd", Client_OrigUser(Client), &conv, &pam);