/* * m_pass() - Added Sat, 4 March 1989 * * * mr_pass - PASS message handler * parv[0] = sender prefix * parv[1] = password * parv[2] = "TS" if this server supports TS. * parv[3] = optional TS version field -- needed for TS6 */ static int mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { if(client_p->localClient->passwd) { memset(client_p->localClient->passwd, 0, strlen(client_p->localClient->passwd)); MyFree(client_p->localClient->passwd); } DupNString(client_p->localClient->passwd, parv[1], PASSWDLEN); /* These are for servers only */ if(parc > 2 && client_p->user == NULL) { /* * It looks to me as if orabidoo wanted to have more * than one set of option strings possible here... * i.e. ":AABBTS" as long as TS was the last two chars * however, as we are now using CAPAB, I think we can * safely assume if there is a ":TS" then its a TS server * -Dianora */ if(irccmp(parv[2], "TS") == 0 && client_p->tsinfo == 0) client_p->tsinfo = TS_DOESTS; /* kludge, if we're not using ts6, dont ever mark a server * as TS6 capable, that way we'll never send them TS6 data. */ if(ServerInfo.use_ts6 && parc == 5 && atoi(parv[3]) >= 6) { /* only mark as TS6 if the SID is valid.. */ if(IsDigit(parv[4][0]) && IsIdChar(parv[4][1]) && IsIdChar(parv[4][2]) && parv[4][3] == '\0' && EmptyString(client_p->id)) { client_p->localClient->caps |= CAP_TS6; strcpy(client_p->id, parv[4]); } } } return 0; }
/* * m_pass() - Added Sat, 4 March 1989 * * * mr_pass - PASS message handler * parv[1] = password * parv[2] = "TS" if this server supports TS. * parv[3] = optional TS version field -- needed for TS6 */ static int mr_pass(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { char *pass, *buf; buf = LOCAL_COPY(parv[1]); if(client_p->localClient->passwd) { memset(client_p->localClient->passwd, 0, strlen(client_p->localClient->passwd)); rb_free(client_p->localClient->passwd); client_p->localClient->passwd = NULL; } pass = buf; client_p->localClient->passwd = *pass ? rb_strndup(pass, PASSWDLEN) : NULL; /* These are for servers only */ if(parc > 2 && client_p->user == NULL) { /* * It looks to me as if orabidoo wanted to have more * than one set of option strings possible here... * i.e. ":AABBTS" as long as TS was the last two chars * however, as we are now using CAPAB, I think we can * safely assume if there is a ":TS" then its a TS server * -Dianora */ if(irccmp(parv[2], "TS") == 0 && client_p->tsinfo == 0) client_p->tsinfo = TS_DOESTS; if(parc == 5 && atoi(parv[3]) >= 6) { /* only mark as TS6 if the SID is valid.. */ if(IsDigit(parv[4][0]) && IsIdChar(parv[4][1]) && IsIdChar(parv[4][2]) && parv[4][3] == '\0' && EmptyString(client_p->id)) { client_p->localClient->caps |= CAP_TS6; strcpy(client_p->id, parv[4]); } } } return 0; }
static void DefineSymbol (const char* Def) /* Define a symbol from the command line */ { const char* P; long Val; StrBuf SymName = AUTO_STRBUF_INITIALIZER; /* The symbol must start with a character or underline */ if (!IsIdStart (Def [0])) { InvDef (Def); } P = Def; /* Copy the symbol, checking the rest */ while (IsIdChar (*P)) { SB_AppendChar (&SymName, *P++); } SB_Terminate (&SymName); /* Do we have a value given? */ if (*P != '=') { if (*P != '\0') { InvDef (Def); } Val = 0; } else { /* We have a value */ ++P; if (*P == '$') { ++P; if (sscanf (P, "%lx", &Val) != 1) { InvDef (Def); } } else { if (sscanf (P, "%li", &Val) != 1) { InvDef (Def); } } } /* Define the new symbol */ NewSymbol (SB_GetConstBuf (&SymName), Val); /* Release string memory */ SB_Done (&SymName); }
static void ReadIdent (void) /* Read an identifier from the current input position into Ident. Filling SVal ** starts at the current position with the next character in C. It is assumed ** that any characters already filled in are ok, and the character in C is ** checked. */ { /* Read the identifier */ do { SB_AppendChar (&CurTok.SVal, C); NextChar (); } while (IsIdChar (C)); SB_Terminate (&CurTok.SVal); /* If we should ignore case, convert the identifier to upper case */ if (IgnoreCase) { UpcaseSVal (); } }
static void FuncIdent (void) /* Handle the .IDENT function */ { StrBuf Buf = STATIC_STRBUF_INITIALIZER; token_t Id; unsigned I; /* Skip it */ NextTok (); /* Left paren expected */ ConsumeLParen (); /* The function expects a string argument */ if (!LookAtStrCon ()) { return; } /* Check that the string contains a valid identifier. While doing so, * determine if it is a cheap local, or global one. */ SB_Reset (&CurTok.SVal); /* Check for a cheap local symbol */ if (SB_Peek (&CurTok.SVal) == LocalStart) { SB_Skip (&CurTok.SVal); Id = TOK_LOCAL_IDENT; } else { Id = TOK_IDENT; } /* Next character must be a valid identifier start */ if (!IsIdStart (SB_Get (&CurTok.SVal))) { NoIdent (); return; } for (I = SB_GetIndex (&CurTok.SVal); I < SB_GetLen (&CurTok.SVal); ++I) { if (!IsIdChar (SB_AtUnchecked (&CurTok.SVal, I))) { NoIdent (); return; } } if (IgnoreCase) { UpcaseSVal (); } /* If anything is ok, save and skip the string. Check that the next token * is a right paren, then replace the token by an identifier token. */ SB_Copy (&Buf, &CurTok.SVal); NextTok (); if (CurTok.Tok != TOK_RPAREN) { Error ("`)' expected"); } else { CurTok.Tok = Id; SB_Copy (&CurTok.SVal, &Buf); SB_Terminate (&CurTok.SVal); } /* Free buffer memory */ SB_Done (&Buf); }