[srvx-commits] CVS: services/src hash.h,1.96,1.97 nickserv.c,1.217,1.218
Brought to you by:
entrope
|
From: Zoot <zo...@us...> - 2002-12-15 09:59:42
|
Update of /cvsroot/srvx/services/src
In directory sc8-pr-cvs1:/tmp/cvs-serv30739/src
Modified Files:
hash.h nickserv.c
Log Message:
Don't allow users who have been stamped to authenticate or otherwise associate with a handle.
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.96
retrieving revision 1.97
diff -C2 -r1.96 -r1.97
*** hash.h 14 Nov 2002 02:22:35 -0000 1.96
--- hash.h 15 Dec 2002 09:59:38 -0000 1.97
***************
*** 66,69 ****
--- 66,70 ----
#define IsGagged(x) ((x)->modes & FLAGS_GAGGED)
#define IsAway(x) ((x)->modes & FLAGS_AWAY)
+ #define IsStamped(x) ((x)->modes & FLAGS_STAMPED)
#define IsHiddenHost(x) ((x)->modes & FLAGS_HIDDEN_HOST)
#define IsLocal(x) ((x)->uplink == self)
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -C2 -r1.217 -r1.218
*** nickserv.c 22 Nov 2002 04:10:32 -0000 1.217
--- nickserv.c 15 Dec 2002 09:59:38 -0000 1.218
***************
*** 134,137 ****
--- 134,142 ----
#define NSMSG_HOSTMASK_INVALID "Your hostmask is not valid for account $b%s$b."
#define NSMSG_USER_IS_SERVICE "$b%s$b is a network service; you can only use that command on real users."
+
+ #define NSMSG_STAMPED_REGISTER "You have already authenticated to an account once this session; you may not register a new account."
+ #define NSMSG_STAMPED_AUTH "You have already authenticated to an account once this session; you may not authenticate to another."
+ #define NSMSG_STAMPED_COOKIE "You have already authenticated to an account once this session; you may not use this cookie."
+
#define NSMSG_HANDLEINFO_ON "Account information for $b%s$b:"
#define NSMSG_HANDLEINFO_ID " Account ID: %lu"
***************
*** 1000,1003 ****
--- 1005,1016 ----
}
+ if (IsStamped(user)) {
+ /* Unauthenticated users might still have been stamped
+ previously and could therefore have a hidden host;
+ do not allow them to register a new account. */
+ nickserv_notice(user, NSMSG_STAMPED_REGISTER);
+ return 0;
+ }
+
NICKSERV_MIN_PARMS((unsigned)3 + nickserv_conf.email_required);
***************
*** 1348,1351 ****
--- 1361,1371 ----
return 0;
}
+ if (IsStamped(user)) {
+ /* Unauthenticated users might still have been stamped
+ previously and could therefore have a hidden host;
+ do not allow them to authenticate. */
+ nickserv_notice(user, NSMSG_STAMPED_AUTH);
+ return 0;
+ }
if (argc == 3) {
hi = dict_find(nickserv_handle_dict, argv[1], NULL);
***************
*** 1578,1581 ****
--- 1598,1608 ----
switch (hi->cookie->type) {
case ACTIVATION:
+ if (IsStamped(user)) {
+ /* Unauthenticated users might still have been stamped
+ previously and could therefore have a hidden host;
+ do not allow them to activate a new account. */
+ nickserv_notice(user, NSMSG_STAMPED_COOKIE);
+ return 0;
+ }
safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd));
set_user_handle_info(user, hi, 1);
***************
*** 1583,1586 ****
--- 1610,1620 ----
break;
case PASSWORD_CHANGE:
+ if (IsStamped(user)) {
+ /* Unauthenticated users might still have been stamped
+ previously and could therefore have a hidden host;
+ do not allow them to activate an account. */
+ nickserv_notice(user, NSMSG_STAMPED_COOKIE);
+ return 0;
+ }
set_user_handle_info(user, hi, 1);
safestrncpy(hi->passwd, hi->cookie->data, sizeof(hi->passwd));
***************
*** 1592,1595 ****
--- 1626,1636 ----
break;
case ALLOWAUTH:
+ if (IsStamped(user)) {
+ /* Unauthenticated users might still have been stamped
+ previously and could therefore have a hidden host;
+ do not allow them to authenticate to an account. */
+ nickserv_notice(user, NSMSG_STAMPED_COOKIE);
+ return 0;
+ }
set_user_handle_info(user, hi, 1);
nickserv_notice(user, NSMSG_AUTH_SUCCESS);
|