diff options
author | trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-10-22 05:06:02 +0000 |
---|---|---|
committer | trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-10-22 05:06:02 +0000 |
commit | 91e8ac0878ecac082bc1b87f433deb9fe3ad32e4 (patch) | |
tree | 51aa1f02e06fb6c18f3da25ce3268881c36feabc | |
parent | bb86fdcab2b31bc5d652006c523e25d699bacab1 (diff) |
BUILD : 1.7.5 (415) BUGS : N/A NOTES : Fixes Unreal NICKIP and SVSMODE, Updated Base64 lib to fix NICKIP, Updated Spanish language file
git-svn-id: svn://svn.anope.org/anope/trunk@415 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@278 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes | 2 | ||||
-rw-r--r-- | include/extern.h | 4 | ||||
-rw-r--r-- | lang/es.l | 115 | ||||
-rw-r--r-- | src/base64.c | 283 | ||||
-rw-r--r-- | src/unreal32.c | 5 | ||||
-rw-r--r-- | version.log | 6 |
6 files changed, 343 insertions, 72 deletions
@@ -31,6 +31,7 @@ Provided by Trystan <trystan@nomadirc.net> - 2004 09/07 A Ircd CHANMODE now trapped and stored. [ #00] 08/23 A New protocol independent design (aka anope-capab). [ #00] 08/28 A New IRCD document for adding new ircd support to new design. [ #00] +10/20 F Updated Base64 Lib to fix Unreal NICKIP. [ #00] 10/16 F Fixed BS TTB. [#185] 10/16 F RestrictOperNicks is no longer case sensitive. [#190] 10/16 F Fixed tsbuf not being sent on registration. [#180] @@ -62,6 +63,7 @@ Provided by Trystan <trystan@nomadirc.net> - 2004 Provided by DrStein <gacevedo@anope.org> - 2004 10/05 A CS/NS INFO shows the expire time. [ #00] 10/05 A NS GLIST shows the expire time. [ #00] +10/21 F Updated Spanish language file. [ #00] 10/15 F More Check and trap for forbidden nicks on HS. [#183] 10/07 F NEWS reordering issue [ #00] 10/05 F NS GLIST allows the owner of the nick to use the nickname param. [ #00] diff --git a/include/extern.h b/include/extern.h index 106e82de7..440708c40 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1098,6 +1098,10 @@ extern char *send_token(char *token1, char *token2); extern char *base64enc(long i); extern long base64dec(char *b64); extern long base64dects(char *ts); +extern int b64_encode(unsigned char const *src, size_t srclength, char *target, size_t targsize); +extern int b64_decode(char const *src, unsigned char *target, size_t targsize); +extern char *encode_ip(u_char *ip); +extern int decode_ip(char *buf); #define Anope_Free(x) if ((x) != NULL) free(x) @@ -20,7 +20,7 @@ # In help messages, "%S" (capital S, not lowercase) refers to the name of # the service sending the message; for example, in NickServ help messages, # "%S" is replaced by "NickServ" (or whatever it is renamed to in -# config.h). The %S's do not count as sprintf() parameters, so they can be +# services.conf). The %S's do not count as sprintf() parameters, so they can be # rearranged, removed, or added as necessary. # # Also in help messages, please try to limit line lengths to 60 characters @@ -517,9 +517,9 @@ NICK_SET_HIDE_QUIT_OFF # SET MSG responses NICK_SET_HIDE_STATUS_ON - Your services access status will now be hidden from %s INFO displays. + Tu estado de acceso a los Servicios no sera mostrado en %s INFO. NICK_SET_HIDE_STATUS_OFF - Your services access status will now be shown in %s INFO displays. + Tu estado de acceso a los Servicios ahora sera mostrado en %s INFO. # SET MSG responses NICK_SET_MSG_SYNTAX @@ -664,7 +664,7 @@ NICK_RECOVER_SYNTAX NICK_NO_RECOVER_SELF No puedes recuperarte a ti mismo! NICK_RECOVERED - El usuario clamando tu nick ha sido killeado. + El usuario que ocupaba tu nick ha sido killeado. /msg %s RELEASE %s para recuperarlo antes del minuto de time-out. # RELEASE responses @@ -1345,13 +1345,13 @@ CHAN_LEVELS_RESET # Status Messages CHAN_STATUS_SYNTAX - STATUS ERROR Syntax error + STATUS ERROR Error de sintaxis CHAN_STATUS_NOT_REGGED - STATUS ERROR Channel %s not registered + STATUS ERROR El canal %s no esta registrado CHAN_STATUS_FORBIDDEN - STATUS ERROR Channel %s forbidden + STATUS ERROR El canal %s esta prohibido CHAN_STATUS_NOTONLINE - STATUS ERROR Nick %s not online + STATUS ERROR El nick %s no esta online CHAN_STATUS_INFO STATUS %s %s %d @@ -1457,13 +1457,13 @@ CHAN_CLEARED_MODES CHAN_CLEARED_OPS Modo +o ha sido removido del canal %s. CHAN_CLEARED_HOPS - Mode +h has been cleared from channel %s. + El modo +h ha sido removido del canal %s. CHAN_CLEARED_VOICES Modo +v ha sido removido del canal %s. CHAN_CLEARED_USERS Todos los usuarios han sido kickeados del canal %s. CHAN_CLEARED_INVITES - All invites on channel %s have been removed. + Todos los invites en el canal %s han sido removidos. # GETPASS responses CHAN_GETPASS_SYNTAX @@ -1673,11 +1673,11 @@ MEMO_SET_NOTIFY_OFF # SET LIMIT responses MEMO_SET_NOTIFY_MAIL - You will now be informed about new memos via email. + Seras informado de nuevos memos via email. MEMO_SET_NOTIFY_NOMAIL - You will no longer be informed via email. + No seras informado de nuevos memos via email. MEMO_SET_NOTIFY_INVALIDMAIL - There's no email address set for your nick. + Tu nick no tiene una direccion de e-mail. # SET LIMIT responses MEMO_SET_LIMIT_SYNTAX @@ -1772,59 +1772,40 @@ MEMO_INFO_X_NOTIFY_RECEIVE %s es notificado cuando nuevos memos le son enviados. MEMO_INFO_X_NOTIFY_SIGNON %s es notificado de nuevos memos cuando se conecta. - -########################################################################### -# -# BotServ messages -# -########################################################################### - + # Standard responses MEMO_MAIL_SUBJECT - New memo + Nuevo memo MEMO_MAIL_TEXT1 - Hi %s + Hola %s MEMO_MAIL_TEXT2 - You've just received a new memo from %s. This is memo number %d. + Acabas de recibir un nuevo memo de %s. Es el memo numero %d. MEMO_MAIL_TEXT3 - Memo Text: + Texto del Memo: -########################################################################### -# -# BotServ messages -# -########################################################################### - # Standard responses MEMO_RSEND_PLEASE_WAIT - Please wait %d seconds before using the RSEND command again. + Por favor espera %d segundos antes de usar el comando RSEND nuevamente. MEMO_RSEND_DISABLED - Sorry, RSEND has been disabled on this network. + Lo siento, RSEND ha sido deshabilitado en esta red. MEMO_RSEND_SYNTAX - RSEND {nick | channel} memo-text + RSEND {nick | canal} texto-memo MEMO_RSEND_NICK_MEMO_TEXT - [auto-memo] The memo you sent has been viewed. + [auto-memo] El memo que enviaste ha sido leido. MEMO_RSEND_CHAN_MEMO_TEXT - [auto-memo] The memo you sent to %s has been viewed. + [auto-memo] El memo que enviaste a %s ha sido leido. MEMO_RSEND_USER_NOTIFICATION - A notification memo has been sent to %s informing him/her you have - read his/her memo. + Una notificacion ha sido enviada a %s informando que has leido su memo. -########################################################################### -# -# BotServ messages -# -########################################################################### - # Standard responses MEMO_CHECK_SYNTAX CHECK nickname MEMO_CHECK_NOT_READ - The last memo you sent to %s (sent on %s) has not yet been read. + El ultimo memo que enviaste a %s (enviado el %s) aun no ha sido leido. MEMO_CHECK_READ - The last memo you sent to %s (sent on %s) has been read. + El ultimo memo que enviaste a %s (enviado el %s) ha sido leido. MEMO_CHECK_NO_MEMO - Nick %s doesn't have a memo from you. + El nick %s no ha recibido ningun memo tuyo. ########################################################################### # @@ -2374,7 +2355,7 @@ OPER_UMODE_CHANGED OPER_OLINE_SYNTAX OLINE nick opciones OPER_OLINE_SUCCESS - Una linea O: con las opciones %s ha sido agregada para %s. + Una O:Line con las opciones %s ha sido agregada para %s. # CLEARMODES responses OPER_OLINE_IRCOP @@ -2618,7 +2599,7 @@ OPER_SZLINE_LIST_EMPTY La lista de SZLINEs esta vacia. OPER_SZLINE_LIST_HEADER Lista actual de SZLINEs: - Num Mask Reason + Num Mascara Razon OPER_SZLINE_LIST_FORMAT %3d %-32s %s OPER_SZLINE_VIEW_HEADER @@ -2698,7 +2679,8 @@ OPER_RELOAD # RESTART responses OPER_CANNOT_RESTART - SERVICES_BIN no definido; imposible partir nuevamente. Corre nuevamente el script \2configure\2 y recompila Services para incluir el comando RESTART. + SERVICES_BIN no definido; imposible partir nuevamente. Corre nuevamente el + script \2configure\2 y recompila Services para incluir el comando RESTART. # IGNORE responses OPER_IGNORE_SYNTAX @@ -2960,7 +2942,7 @@ OPER_SESSION_LIST_FORMAT %6d %s # host, sessions, limit OPER_SESSION_VIEW_FORMAT - El host %s actualmente tiene %d sesiones con un limite de %d. + El host %s actualmente tiene %d sesiones con un limite de %d. # EXCEPTION help @@ -5070,15 +5052,14 @@ MEMO_HELP_SENDALL ########################################################################### MEMO_HELP_RSEND - Syntax: RSEND {nick | channel} memo-text - - Sends the named nick or channel a memo containing - memo-text. When sending to a nickname, the recipient will - receive a notice that he/she has a new memo. The target - nickname/channel must be registered. - Once the memo is read by its recepient, an automatic notification - memo will be sent to the sender informing him/her that the memo - has been read. + Sintaxis: RSEND {nick | canal} texto-memo + + Envia a nick o canal un memo conteniendo memo-text. + Cuando se envia a un nickname, el receptor recibira una noticia + informandole que tiene un nuevo memo. El nickname o canal al cual se le + enviara el memo debe estar registrado. + Una vez que el memo ha sido leido, quien envio el memo recibira una + notificacion automatica informando que el memo ha sido leido. ########################################################################### # @@ -5087,10 +5068,10 @@ MEMO_HELP_RSEND ########################################################################### MEMO_HELP_CHECK - Syntax: CHECK nick - - Checks whether the _last_ memo you sent to nick has been read - or not. Note that this does only work with nicks, not with chans. + Sintaxis: CHECK nick + + Verifica que el _ultimo_ memo que enviaste a nick haya sido leido. + Nota que esto solo funciona para nicknames, no para canales. ########################################################################### # @@ -6333,14 +6314,14 @@ HOST_HELP_GROUP mismo grupo. OPER_SVSNICK_UNSUPPORTED - Sorry, SVSNICK is not available on this network. + Lo siento, SVSNICK no esta disponible en esta red. OPER_SQLINE_UNSUPPORTED - Sorry, SQLINE is not available on this network. + Lo siento, SQLINE no esta disponible en esta red. OPER_SVSO_UNSUPPORTED - Sorry, OLINE is not available on this network. + Lo siento, OLINE no esta disponible en esta red. OPER_UMODE_UNSUPPORTED - Sorry, UMODE is not available on this network. + Lo siento, OLINE no esta disponible en esta red. diff --git a/src/base64.c b/src/base64.c index 90b933039..e97a2a196 100644 --- a/src/base64.c +++ b/src/base64.c @@ -35,6 +35,287 @@ long base64dec(char *b64) return 0; } + +static const char Base64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char Pad64 = '='; + +/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) + The following encoding technique is taken from RFC 1521 by Borenstein + and Freed. It is reproduced here in a slightly edited form for + convenience. + + A 65-character subset of US-ASCII is used, enabling 6 bits to be + represented per printable character. (The extra 65th character, "=", + is used to signify a special processing function.) + + The encoding process represents 24-bit groups of input bits as output + strings of 4 encoded characters. Proceeding from left to right, a + 24-bit input group is formed by concatenating 3 8-bit input groups. + These 24 bits are then treated as 4 concatenated 6-bit groups, each + of which is translated into a single digit in the base64 alphabet. + + Each 6-bit group is used as an index into an array of 64 printable + characters. The character referenced by the index is placed in the + output string. + + Table 1: The Base64 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 17 R 34 i 51 z + 1 B 18 S 35 j 52 0 + 2 C 19 T 36 k 53 1 + 3 D 20 U 37 l 54 2 + 4 E 21 V 38 m 55 3 + 5 F 22 W 39 n 56 4 + 6 G 23 X 40 o 57 5 + 7 H 24 Y 41 p 58 6 + 8 I 25 Z 42 q 59 7 + 9 J 26 a 43 r 60 8 + 10 K 27 b 44 s 61 9 + 11 L 28 c 45 t 62 + + 12 M 29 d 46 u 63 / + 13 N 30 e 47 v + 14 O 31 f 48 w (pad) = + 15 P 32 g 49 x + 16 Q 33 h 50 y + + Special processing is performed if fewer than 24 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a quantity. When fewer than 24 input + bits are available in an input group, zero bits are added (on the + right) to form an integral number of 6-bit groups. Padding at the + end of the data is performed using the '=' character. + + Since all base64 input is an integral number of octets, only the + ------------------------------------------------- + following cases can arise: + + (1) the final quantum of encoding input is an integral + multiple of 24 bits; here, the final unit of encoded + output will be an integral multiple of 4 characters + with no "=" padding, + (2) the final quantum of encoding input is exactly 8 bits; + here, the final unit of encoded output will be two + characters followed by two "=" padding characters, or + (3) the final quantum of encoding input is exactly 16 bits; + here, the final unit of encoded output will be three + characters followed by one "=" padding character. + */ + +int b64_encode(unsigned char const *src, size_t srclength, char *target, + size_t targsize) +{ + size_t datalength = 0; + u_char input[3]; + u_char output[4]; + size_t i; + + while (2 < srclength) { + input[0] = *src++; + input[1] = *src++; + input[2] = *src++; + srclength -= 3; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + output[3] = input[2] & 0x3f; + + if (datalength + 4 > targsize) + return (-1); + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + target[datalength++] = Base64[output[2]]; + target[datalength++] = Base64[output[3]]; + } + + /* Now we worry about padding. */ + if (0 != srclength) { + /* Get what's left. */ + input[0] = input[1] = input[2] = '\0'; + for (i = 0; i < srclength; i++) + input[i] = *src++; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + + if (datalength + 4 > targsize) + return (-1); + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + if (srclength == 1) + target[datalength++] = Pad64; + else + target[datalength++] = Base64[output[2]]; + target[datalength++] = Pad64; + } + if (datalength >= targsize) + return (-1); + target[datalength] = '\0'; /* Returned value doesn't count \0. */ + return (datalength); +} + +/* skips all whitespace anywhere. + converts characters, four at a time, starting at (or after) + src from base - 64 numbers into three 8 bit bytes in the target area. + it returns the number of data bytes stored at the target, or -1 on error. + */ + +int b64_decode(char const *src, unsigned char *target, size_t targsize) +{ + int tarindex, state, ch; + char *pos; + + state = 0; + tarindex = 0; + + while ((ch = *src++) != '\0') { + if (isspace(ch)) /* Skip whitespace anywhere. */ + continue; + + if (ch == Pad64) + break; + + pos = strchr(Base64, ch); + if (pos == 0) /* A non-base64 character. */ + return (-1); + + switch (state) { + case 0: + if (target) { + if ((size_t) tarindex >= targsize) + return (-1); + target[tarindex] = (pos - Base64) << 2; + } + state = 1; + break; + case 1: + if (target) { + if ((size_t) tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 4; + target[tarindex + 1] = ((pos - Base64) & 0x0f) + << 4; + } + tarindex++; + state = 2; + break; + case 2: + if (target) { + if ((size_t) tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 2; + target[tarindex + 1] = ((pos - Base64) & 0x03) + << 6; + } + tarindex++; + state = 3; + break; + case 3: + if (target) { + if ((size_t) tarindex >= targsize) + return (-1); + target[tarindex] |= (pos - Base64); + } + tarindex++; + state = 0; + break; + default: + abort(); + } + } + + /* + * We are done decoding Base-64 chars. Let's see if we ended + * on a byte boundary, and/or with erroneous trailing characters. + */ + + if (ch == Pad64) { /* We got a pad char. */ + ch = *src++; /* Skip it, get next. */ + switch (state) { + case 0: /* Invalid = in first position */ + case 1: /* Invalid = in second position */ + return (-1); + + case 2: /* Valid, means one byte of info */ + /* Skip any number of spaces. */ + for ((void) NULL; ch != '\0'; ch = *src++) + if (!isspace(ch)) + break; + /* Make sure there is another trailing = sign. */ + if (ch != Pad64) + return (-1); + ch = *src++; /* Skip the = */ + /* Fall through to "single trailing =" case. */ + /* FALLTHROUGH */ + + case 3: /* Valid, means two bytes of info */ + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for ((void) NULL; ch != '\0'; ch = *src++) + if (!isspace(ch)) + return (-1); + + /* + * Now make sure for cases 2 and 3 that the "extra" + * bits that slopped past the last full byte were + * zeros. If we don't check them, they become a + * subliminal channel. + */ + if (target && target[tarindex] != 0) + return (-1); + } + } else { + /* + * We ended by seeing the end of the string. Make sure we + * have no partial bytes lying around. + */ + if (state != 0) + return (-1); + } + + return (tarindex); +} + +char *encode_ip(u_char * ip) +{ + static char buf[25]; + u_char *cp; + struct in_addr ia; /* For IPv4 */ + + if (!ip) + return "*"; + + if (strchr(ip, ':')) { + return NULL; + } else { + ia.s_addr = inet_addr(ip); + cp = (u_char *) ia.s_addr; + b64_encode((char *) &cp, sizeof(struct in_addr), buf, 25); + } + return buf; +} + +int decode_ip(char *buf) +{ + int len = strlen(buf); + char targ[25]; + struct in_addr ia; + + b64_decode(buf, targ, 25); + ia = *(struct in_addr *) targ; + if (len == 24) { /* IPv6 */ + return 0; + } else if (len == 8) /* IPv4 */ + return ia.s_addr; + else /* Error?? */ + return 0; +} + /* ':' and '#' and '&' and '+' and '@' must never be in this table. */ /* these tables must NEVER CHANGE! >) */ char int6_to_base64_map[] = { @@ -119,7 +400,7 @@ long base64dects(char *ts) token = myStrGetToken(ts, '!', 1); if (!token) { - return strtoul(ts, NULL, 10);; + return strtoul(ts, NULL, 10); } return base64dec(token); } diff --git a/src/unreal32.c b/src/unreal32.c index 71573e5af..8766df588 100644 --- a/src/unreal32.c +++ b/src/unreal32.c @@ -796,7 +796,7 @@ void anope_cmd_svskill(char *source, char *user, const char *fmt, ...) */ void anope_cmd_svsmode(User * u, int ac, char **av) { - if (ac > 1) { + if (ac >= 1) { if (!u || !av[0]) { return; } @@ -1742,7 +1742,6 @@ int anope_event_sethost(char *source, int ac, char **av) return MOD_CONT; } - /* ** NICK - new ** source = NULL @@ -1793,7 +1792,7 @@ int anope_event_nick(char *source, int ac, char **av) user = do_nick(source, av[0], av[3], av[4], av[5], av[10], strtoul(av[2], NULL, 10), strtoul(av[6], NULL, 0), - base64dec(av[9]), av[8], NULL); + ntohl(decode_ip(av[9])), av[8], NULL); if (user) anope_set_umode(user, 1, &av[7]); diff --git a/version.log b/version.log index 8ef01aa34..532436afa 100644 --- a/version.log +++ b/version.log @@ -8,10 +8,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="5" -VERSION_BUILD="414" +VERSION_BUILD="415" # $Log$ # +# BUILD : 1.7.5 (415) +# BUGS : N/A +# NOTES : Fixes Unreal NICKIP and SVSMODE, Updated Base64 lib to fix NICKIP, Updated Spanish language file +# # BUILD : 1.7.5 (414) # BUGS : N/A # NOTES : Deleted compile.sh as it wont work anymore anyway |