[srvx-commits] CVS: services/src hash.h,1.89,1.90 nickserv.c,1.198,1.199 nickserv.h,1.37,1.38 proto-
Brought to you by:
entrope
|
From: Zoot <zo...@us...> - 2002-08-21 05:42:47
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv24940/src
Modified Files:
hash.h nickserv.c nickserv.h proto-bahamut.c
Log Message:
Support account stamping on Bahamut; rework P10 account stamping to use the account name, and don't accept stamps for users older than the account the stamp represents.
Index: hash.h
===================================================================
RCS file: /cvsroot/srvx/services/src/hash.h,v
retrieving revision 1.89
retrieving revision 1.90
diff -C2 -r1.89 -r1.90
*** hash.h 14 Aug 2002 02:51:11 -0000 1.89
--- hash.h 21 Aug 2002 05:42:44 -0000 1.90
***************
*** 83,86 ****
--- 83,89 ----
#define MAXBANS 30
+ /* IDLEN is 6 because it takes 5.33 Base64 digits to store 32 bytes. */
+ #define IDLEN 6
+
DECLARE_LIST(userList, struct userNode*);
DECLARE_LIST(modeList, struct modeNode*);
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -C2 -r1.198 -r1.199
*** nickserv.c 20 Aug 2002 02:47:15 -0000 1.198
--- nickserv.c 21 Aug 2002 05:42:45 -0000 1.199
***************
*** 762,769 ****
--- 762,773 ----
if (stamp) {
+ #ifdef WITH_PROTOCOL_P10
+ char *id = hi->handle;
+ #else
char id[IDLEN + 1];
/* Stamp the user with an account ID. */
inttobase64(id, hi->id, IDLEN);
+ #endif
StampUser(user, id);
}
***************
*** 3032,3037 ****
--- 3036,3052 ----
struct handle_info *hi;
+ #ifdef WITH_PROTOCOL_P10
+ hi = dict_find(nickserv_handle_dict, stamp, NULL);
+ #else
hi = dict_find(nickserv_id_dict, stamp, NULL);
+ #endif
+
if (hi) {
+ /* If the user is older than the account, ignore the
+ stamp, as it may be invalid. */
+ if (hi->registered > user->timestamp) {
+ return;
+ }
+
/* valid_user_for() is theoretically unnecessary here
because users must authenticate to receive a stamp
Index: nickserv.h
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** nickserv.h 8 Aug 2002 00:11:15 -0000 1.37
--- nickserv.h 21 Aug 2002 05:42:45 -0000 1.38
***************
*** 27,33 ****
#define COOKIELEN 10
- /* IDLEN is 6 because it takes 5.33 Base64 digits to store 32 bytes. */
- #define IDLEN 6
-
/* HI_FLAG_* go into handle_info.flags */
#define HI_FLAG_OPER_SUSPENDED 0x00000001
--- 27,30 ----
Index: proto-bahamut.c
===================================================================
RCS file: /cvsroot/srvx/services/src/proto-bahamut.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** proto-bahamut.c 20 Aug 2002 03:24:56 -0000 1.19
--- proto-bahamut.c 21 Aug 2002 05:42:45 -0000 1.20
***************
*** 39,42 ****
--- 39,44 ----
static void privmsg_user_helper(struct userNode *un, void *data);
+ void irc_svsmode(struct userNode *target, char *modes, unsigned long stamp);
+
struct server *
AddServer(struct server *uplink, const char *name, int hops, time_t boot, time_t link, const char *numeric, const char *description) {
***************
*** 224,230 ****
if (IsGlobal(user)) modes[modelen++] = 'g';
modes[modelen] = 0;
! putsock("NICK %s %d "FMT_TIME_T" +%s %s %s %s %lu 0 :%s",
user->nick, user->uplink->hops+2, user->timestamp, modes,
! user->ident, user->hostname, user->uplink->name, user->ip, user->info);
}
--- 226,232 ----
if (IsGlobal(user)) modes[modelen++] = 'g';
modes[modelen] = 0;
! putsock("NICK %s %d "FMT_TIME_T" +%s %s %s %s %lu %lu :%s",
user->nick, user->uplink->hops+2, user->timestamp, modes,
! user->ident, user->hostname, user->uplink->name, (unsigned long)0, user->ip, user->info);
}
***************
*** 232,237 ****
irc_account(struct userNode *user, const char *stamp)
{
! /* ACCOUNT: NOOP on Bahamut until I look at it. -- Zoot */
! (void)user;(void)stamp;
}
--- 234,238 ----
irc_account(struct userNode *user, const char *stamp)
{
! irc_svsmode(user, "+d", base64toint(stamp, IDLEN));
}
***************
*** 351,354 ****
--- 352,364 ----
void
+ irc_svsmode(struct userNode *target, char *modes, unsigned long stamp) {
+ if (stamp) {
+ putsock(":%s SVSMODE %s "FMT_TIME_T" %s %lu", self->name, target->nick, target->timestamp, modes, stamp);
+ } else {
+ putsock(":%s SVSMODE %s "FMT_TIME_T" %s", self->name, target->nick, target->timestamp, modes);
+ }
+ }
+
+ void
irc_kick(struct userNode *who, struct userNode *target, struct chanNode *from, const char *msg) {
putsock(":%s KICK %s %s :%s", who->nick, from->name, target->nick, msg);
***************
*** 674,679 ****
} else {
/* new nick from a server */
! if (argc < 11) return 0;
! AddUser(GetServerH(argv[7]), argv[1], argv[5], argv[6], argv[4], argv[argc-1], atoi(argv[3]), atoi(argv[9]));
}
return 1;
--- 684,707 ----
} else {
/* new nick from a server */
! if (argc < 10) return 0;
! if (argc > 10) {
! un = AddUser(GetServerH(argv[7]), argv[1], argv[5], argv[6], argv[4], argv[argc-1], atoi(argv[3]), atoi(argv[9]));
! } else {
! /* No IP address received. */
! un = AddUser(GetServerH(argv[7]), argv[1], argv[5], argv[6], argv[4], argv[argc-1], atoi(argv[3]), 0);
! }
!
! if(un)
! {
! unsigned long stamp;
!
! stamp = strtoul(argv[8], NULL, 0);
! if (stamp) {
! char id[IDLEN + 1];
!
! inttobase64(id, stamp, IDLEN);
! call_account_func(un, id);
! }
! }
}
return 1;
|