From: Chris Porter Date: Thu, 7 Aug 2008 00:58:41 +0000 (+0100) Subject: Various changes to support authname being stored inside the authext. X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/3294b10b165b8f9c1e7896b89015e9eccd14db24 Various changes to support authname being stored inside the authext. Q and ticketauth now send authflags. --- diff --git a/chanserv/Makefile.in b/chanserv/Makefile.in index f17b0447..c41221d6 100644 --- a/chanserv/Makefile.in +++ b/chanserv/Makefile.in @@ -4,7 +4,7 @@ CSDIRS=database chancmds usercmds authcmds authtracker newsearch .PHONY: all dirs $(CSDIRS) clean -all: chanserv.so chanserv_protect.so chanserv_grep.so chanserv_relay.so dirs +all: chanserv.so chanserv_protect.so chanserv_grep.so chanserv_relay.so chanserv_flags.so dirs dirs: $(CSDIRS) ln -sf */*.so . @@ -27,3 +27,4 @@ chanserv_grep.so: chanserv_grep.o chanserv_relay.so: chanserv_relay.o +chanserv_flags.so: chanserv_flags.o diff --git a/chanserv/authcmds/login.c b/chanserv/authcmds/login.c index a12bcbdd..9599de10 100644 --- a/chanserv/authcmds/login.c +++ b/chanserv/authcmds/login.c @@ -138,7 +138,8 @@ int csa_auth(void *source, int cargc, char **cargv, CRAlgorithm alg) { chanservstdmessage(sender, QM_AUTHOK, rup->username); cs_log(sender,"%s OK username %s", authtype,rup->username); - localusersetaccountflags(sender, rup->username, rup->ID, 0, rup->lastauth); + + localusersetaccount(sender, rup->username, rup->ID, cs_accountflagmap(rup), rup->lastauth); return CMD_OK; } diff --git a/chanserv/chanserv.c b/chanserv/chanserv.c index 1ed71168..09bcd425 100644 --- a/chanserv/chanserv.c +++ b/chanserv/chanserv.c @@ -18,67 +18,6 @@ int chanserv_init_status; sstring **chantypes; sstring *cs_quitreason; -const flag rcflags[] = { - { 'a', QCFLAG_AUTOOP }, - { 'b', QCFLAG_BITCH }, - { 'c', QCFLAG_AUTOLIMIT }, - { 'e', QCFLAG_ENFORCE }, - { 'f', QCFLAG_FORCETOPIC }, - { 'g', QCFLAG_AUTOVOICE }, - { 'i', QCFLAG_INFO }, - { 'j', QCFLAG_JOINED }, - { 'k', QCFLAG_KNOWNONLY }, - { 'p', QCFLAG_PROTECT }, - { 's', QCFLAG_NOINFO }, - { 't', QCFLAG_TOPICSAVE }, - { 'v', QCFLAG_VOICEALL }, - { 'w', QCFLAG_WELCOME }, - { 'z', QCFLAG_SUSPENDED }, - { '\0', 0 } }; - -const flag rcuflags[] = { - { 'a', QCUFLAG_AUTOOP }, - { 'b', QCUFLAG_BANNED }, - { 'd', QCUFLAG_DENY }, - { 'g', QCUFLAG_AUTOVOICE }, - { 'i', QCUFLAG_INFO }, - { 'j', QCUFLAG_AUTOINVITE }, - { 'k', QCUFLAG_KNOWN }, - { 'm', QCUFLAG_MASTER }, - { 'n', QCUFLAG_OWNER }, - { 'o', QCUFLAG_OP }, - { 'p', QCUFLAG_PROTECT }, - { 'q', QCUFLAG_QUIET }, - { 's', QCUFLAG_NOINFO }, - { 't', QCUFLAG_TOPIC }, - { 'v', QCUFLAG_VOICE }, - { 'w', QCUFLAG_HIDEWELCOME }, - { '\0', 0 } }; - -const flag ruflags[] = { - { 'a', QUFLAG_ADMIN }, - { 'd', QUFLAG_DEV }, - { 'D', QUFLAG_CLEANUPEXEMPT }, - { 'g', QUFLAG_GLINE }, - { 'G', QUFLAG_DELAYEDGLINE }, - { 'h', QUFLAG_HELPER }, - { 'i', QUFLAG_INFO }, - { 'L', QUFLAG_NOAUTHLIMIT }, - { 'n', QUFLAG_NOTICE }, - { 'o', QUFLAG_OPER }, - { 'p', QUFLAG_PROTECT }, - { 'q', QUFLAG_STAFF }, - { 's', QUFLAG_NOINFO }, - { 'T', QUFLAG_TRUST }, - { 'z', QUFLAG_SUSPENDED }, - { '\0', 0 } }; - -const flag mdflags[] = { - { 'l', MDFLAG_LIMIT }, - { 'b', MDFLAG_BANNED }, - { 'u', MDFLAG_ACTLIMIT }, - { '\0', 0 } }; - void chanservfreestuff(); void chanservfinishinit(int hooknum, void *arg); diff --git a/chanserv/chanserv.h b/chanserv/chanserv.h index 6aa48a2c..8b0d8b84 100644 --- a/chanserv/chanserv.h +++ b/chanserv/chanserv.h @@ -895,4 +895,9 @@ void csdb_updatemaillock(maillock *mlp); /* q9snprintf.c */ void q9snprintf(char *buf, size_t size, const char *format, const char *args, ...); void q9vsnprintf(char *buf, size_t size, const char *format, const char *args, va_list ap); + +/* chanserv_flags.c */ +flag_t cs_accountflagmap(reguser *rup); +flag_t cs_accountflagmap_str(char *flags); + #endif diff --git a/chanserv/chanserv_flags.c b/chanserv/chanserv_flags.c new file mode 100644 index 00000000..0836f48b --- /dev/null +++ b/chanserv/chanserv_flags.c @@ -0,0 +1,93 @@ +#include "../chanserv/chanserv.h" + +const flag rcflags[] = { + { 'a', QCFLAG_AUTOOP }, + { 'b', QCFLAG_BITCH }, + { 'c', QCFLAG_AUTOLIMIT }, + { 'e', QCFLAG_ENFORCE }, + { 'f', QCFLAG_FORCETOPIC }, + { 'g', QCFLAG_AUTOVOICE }, + { 'i', QCFLAG_INFO }, + { 'j', QCFLAG_JOINED }, + { 'k', QCFLAG_KNOWNONLY }, + { 'p', QCFLAG_PROTECT }, + { 's', QCFLAG_NOINFO }, + { 't', QCFLAG_TOPICSAVE }, + { 'v', QCFLAG_VOICEALL }, + { 'w', QCFLAG_WELCOME }, + { 'z', QCFLAG_SUSPENDED }, + { '\0', 0 } }; + +const flag rcuflags[] = { + { 'a', QCUFLAG_AUTOOP }, + { 'b', QCUFLAG_BANNED }, + { 'd', QCUFLAG_DENY }, + { 'g', QCUFLAG_AUTOVOICE }, + { 'i', QCUFLAG_INFO }, + { 'j', QCUFLAG_AUTOINVITE }, + { 'k', QCUFLAG_KNOWN }, + { 'm', QCUFLAG_MASTER }, + { 'n', QCUFLAG_OWNER }, + { 'o', QCUFLAG_OP }, + { 'p', QCUFLAG_PROTECT }, + { 'q', QCUFLAG_QUIET }, + { 's', QCUFLAG_NOINFO }, + { 't', QCUFLAG_TOPIC }, + { 'v', QCUFLAG_VOICE }, + { 'w', QCUFLAG_HIDEWELCOME }, + + { '\0', 0 } }; + +const flag ruflags[] = { + { 'a', QUFLAG_ADMIN }, + { 'd', QUFLAG_DEV }, + { 'D', QUFLAG_CLEANUPEXEMPT }, + { 'g', QUFLAG_GLINE }, + { 'G', QUFLAG_DELAYEDGLINE }, + { 'h', QUFLAG_HELPER }, + { 'i', QUFLAG_INFO }, + { 'L', QUFLAG_NOAUTHLIMIT }, + { 'n', QUFLAG_NOTICE }, + { 'o', QUFLAG_OPER }, + { 'p', QUFLAG_PROTECT }, + { 'q', QUFLAG_STAFF }, + { 's', QUFLAG_NOINFO }, + { 'T', QUFLAG_TRUST }, + { 'z', QUFLAG_SUSPENDED }, + { '\0', 0 } }; + +const flag mdflags[] = { + { 'l', MDFLAG_LIMIT }, + { 'b', MDFLAG_BANNED }, + { 'u', MDFLAG_ACTLIMIT }, + { '\0', 0 } }; + +flag_t cs_accountflagmap(reguser *rup) { + authname a2, *a = &a2; + a->flags = 0; + + if(UIsOper(rup)) + SetOperFlag(a); + + if(UIsDev(rup)) + SetDeveloper(a); + + if(UIsAdmin(rup)) + SetAdmin(a); + + if(UIsStaff(rup)) + SetStaff(a); + + if(UIsHelper(rup)) + SetSupport(a); + + return a->flags; +} + +flag_t cs_accountflagmap_str(char *flags) { + reguser r2, *r = &r2; + + setflags(&r->flags, QUFLAG_ALL, flags, ruflags, REJECT_NONE); + + return cs_accountflagmap(r); +} diff --git a/chanserv/usercmds/userflags.c b/chanserv/usercmds/userflags.c index e29ec640..d1e4d940 100644 --- a/chanserv/usercmds/userflags.c +++ b/chanserv/usercmds/userflags.c @@ -23,6 +23,7 @@ int csu_douserflags(void *source, int cargc, char **cargv) { nick *sender=source; reguser *rup=getreguserfromnick(sender), *target; + authname *anp; int arg=0, wasorisoper; flag_t flagmask, changemask, oldflags; char flagbuf[30]; @@ -95,6 +96,10 @@ int csu_douserflags(void *source, int cargc, char **cargv) { #endif } csdb_updateuser(target); + + if ((anp=findauthname(rup->ID))) + localusersetaccountflags(anp, cs_accountflagmap(target)); + chanservstdmessage(sender, QM_DONE); } diff --git a/localuser/localuser.c b/localuser/localuser.c index 518c8aa4..a32c6021 100644 --- a/localuser/localuser.c +++ b/localuser/localuser.c @@ -100,7 +100,7 @@ nick *registerlocaluserflags(char *nickname, char *ident, char *host, char *real newuser->nextbyrealname=newuser->realname->nicks; newuser->realname->nicks=newuser; newuser->umodes=umodes; - + memset(&ipaddress, 0, sizeof(ipaddress)); ((unsigned short *)(ipaddress.in6_16))[5] = 65535; ((unsigned short *)(ipaddress.in6_16))[6] = 127; @@ -121,24 +121,31 @@ nick *registerlocaluserflags(char *nickname, char *ident, char *host, char *real } else { newuser->opername = NULL; } + + newuser->accountts=0; + newuser->auth=NULL; + newuser->authname=NULL; if (IsAccount(newuser)) { - strncpy(newuser->authname,authname,ACCOUNTLEN); newuser->accountts=newuser->timestamp; if (authid) { - newuser->auth=findorcreateauthname(authid, newuser->authname); + newuser->auth=findorcreateauthname(authid, authname); + newuser->authname=newuser->auth->name; newuser->auth->usercount++; newuser->nextbyauthname=newuser->auth->nicks; newuser->auth->nicks=newuser; newuser->auth->flags=accountflags; } else { - newuser->auth=NULL; + /* + this is done for three reasons: + 1: so I don't have to change 500 pieces of code + 2: so services can be authed with special reserved ids + 3: saves space over the old authname per user method + */ + newuser->authname=malloc(strlen(authname) + 1); + strcpy(newuser->authname,authname); } - } else { - newuser->authname[0]='\0'; - newuser->accountts=0; - newuser->auth=NULL; } - + if (connected) { /* Check for nick collision */ if ((np=getnickbynick(nickname))!=NULL) { @@ -276,6 +283,7 @@ void sendnickmsg(nick *np) { operbuf[0] = '\0'; } + accountbuf[0]='\0'; if (IsAccount(np)) { if (np->auth) { if(np->auth->flags) { @@ -283,11 +291,9 @@ void sendnickmsg(nick *np) { } else { snprintf(accountbuf,sizeof(accountbuf)," %s:%ld:%lu",np->authname,np->accountts,np->auth->userid); } - } else { + } else if(np->authname) { snprintf(accountbuf,sizeof(accountbuf)," %s:%ld:0",np->authname,np->accountts); } - } else { - accountbuf[0]='\0'; } irc_send("%s N %s 1 %ld %s %s %s%s%s %s %s :%s", @@ -554,39 +560,44 @@ void checkpendingkills(int hooknum, void *arg) { } } -/* Auth user */ -void localusersetaccountflags(nick *np, char *accname, unsigned long accid, flag_t accountflags, time_t authTS) { +void sendaccountmessage(nick *np) { + if (connected) { + if (np->auth) { + if (np->auth->flags) { + irc_send("%s AC %s %s %ld %lu %lu",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth->userid, np->auth->flags); + } else { + irc_send("%s AC %s %s %ld %lu",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth->userid); + } + } else { + irc_send("%s AC %s %s %ld 0",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts); + } + } +} + +/* Auth user, don't use to set flags after authing */ +void localusersetaccount(nick *np, char *accname, unsigned long accid, flag_t accountflags, time_t authTS) { if (IsAccount(np)) { Error("localuser",ERR_WARNING,"Tried to set account on user %s already authed", np->nick); return; } SetAccount(np); - strncpy(np->authname, accname, ACCOUNTLEN); - np->authname[ACCOUNTLEN]='\0'; np->accountts=authTS?authTS:getnettime(); if (accid) { np->auth=findorcreateauthname(accid, accname); np->auth->usercount++; + np->authname=np->auth->name; np->nextbyauthname=np->auth->nicks; np->auth->nicks=np; np->auth->flags=accountflags; } else { np->auth=NULL; + np->authname=malloc(strlen(accname) + 1); + strcpy(np->authname,accname); } - if (connected) { - if (np->auth) { - if (np->auth->flags) { - irc_send("%s AC %s %s %ld %lu %lu",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth->userid, np->auth->flags); - } else { - irc_send("%s AC %s %s %ld %lu",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts, np->auth->userid); - } - } else { - irc_send("%s AC %s %s %ld 0",mynumeric->content, longtonumeric(np->numeric,5), np->authname, np->accountts); - } - } + sendaccountmessage(np); triggerhook(HOOK_NICK_ACCOUNT, np); } @@ -598,3 +609,17 @@ void localusersetumodes(nick *np, flag_t newmodes) { np->umodes = newmodes; } + +void localusersetaccountflags(authname *anp, flag_t accountflags) { + void *arg[2]; + nick *np; + + arg[0] = (void *)anp; + arg[1] = (void *)(long)anp->flags; + anp->flags = accountflags; + + for(np=anp->nicks;np;np=np->next) + sendaccountmessage(np); + + triggerhook(HOOK_AUTH_FLAGSUPDATED, arg); +} diff --git a/localuser/localuser.h b/localuser/localuser.h index 6b3b078e..2227a7f1 100644 --- a/localuser/localuser.h +++ b/localuser/localuser.h @@ -37,9 +37,9 @@ void sendmessagetouser(nick *source, nick *target, char *format, ... ); void sendsecuremessagetouser(nick *source, nick *target, char *servername, char *format, ... ); void sendnoticetouser(nick *source, nick *target, char *format, ... ); void killuser(nick *source, nick *target, char *format, ... ); -#define localusersetaccount(np, accname) localusersetaccountflags(np, accname, 0) -void localusersetaccountflags(nick *np, char *accname, unsigned long accid, flag_t accountflags, time_t authTS); +void localusersetaccount(nick *np, char *accname, unsigned long accid, flag_t accountflags, time_t authTS); void localusersetumodes(nick *np, flag_t newmodes); void sethostuser(nick *target, char *ident, char *host); +void localusersetaccountflags(authname *anp, flag_t accountflags); #endif diff --git a/nick/nick.c b/nick/nick.c index 809a41d3..bc2b3db0 100644 --- a/nick/nick.c +++ b/nick/nick.c @@ -39,7 +39,7 @@ const flag umodeflags[] = { const flag accountflags[] = { { 'q', AFLAG_STAFF }, - { 's', AFLAG_SUPPORT }, + { 'h', AFLAG_SUPPORT }, { 'o', AFLAG_OPER }, { 'a', AFLAG_ADMIN }, { 'd', AFLAG_DEVELOPER }, @@ -98,6 +98,8 @@ void _fini() { freesstring(np->shident); freesstring(np->sethost); freesstring(np->opername); + if(!np->auth && np->authname) + free(np->authname); } } @@ -179,18 +181,22 @@ void deletenick(nick *np) { releaserealname(np->realname); releasehost(np->host); - if(IsAccount(np) && np->auth) - { - np->auth->usercount--; + if(IsAccount(np)) { + if(!np->auth) { + if(np->authname) + free(np->authname); + } else { + np->auth->usercount--; - for (nh=&(np->auth->nicks);*nh;nh=&((*nh)->nextbyauthname)) { - if (*nh==np) { - *nh=np->nextbyauthname; - break; + for (nh=&(np->auth->nicks);*nh;nh=&((*nh)->nextbyauthname)) { + if (*nh==np) { + *nh=np->nextbyauthname; + break; + } } - } - releaseauthname(np->auth); + releaseauthname(np->auth); + } } freesstring(np->shident); /* freesstring(NULL) is OK */ diff --git a/nick/nick.h b/nick/nick.h index 9076c7ad..c24c0089 100644 --- a/nick/nick.h +++ b/nick/nick.h @@ -90,23 +90,23 @@ #define ClearHideIdle(x) ((x)->umodes &= ~UMODE_HIDEIDLE) #define ClearParanoid(x) ((x)->umodes &= ~UMODE_PARANOID) -#define IsStaff(x) ((x)->umodes & AFLAG_STAFF) -#define IsDeveloper(x) ((x)->umodes & AFLAG_DEVELOPER) -#define IsSupport(x) ((x)->umodes & AFLAG_SUPPORT) -#define IsAdmin(x) ((x)->umodes & AFLAG_ADMIN) -#define IsOperFlag(x) ((x)->umodes & AFLAG_OPER) - -#define SetStaff(x) ((x)->umodes |= AFLAG_STAFF) -#define SetDeveloper(x) ((x)->umodes |= AFLAG_DEVELOPER) -#define SetSupport(x) ((x)->umodes |= AFLAG_SUPPORT) -#define SetAdmin(x) ((x)->umodes |= AFLAG_ADMIN) -#define SetOperFlag(x) ((x)->umodes |= AFLAG_OPER) - -#define ClearStaff(x) ((x)->umodes &= ~AFLAG_STAFF) -#define ClearDeveloper(x) ((x)->umodes &= ~AFLAG_DEVELOPER) -#define ClearSupport(x) ((x)->umodes &= ~AFLAG_SUPPORT) -#define ClearAdmin(x) ((x)->umodes &= ~AFLAG_ADMIN) -#define ClearOperFlag(x) ((x)->umodes &= ~AFLAG_OPER) +#define IsStaff(x) ((x)->flags & AFLAG_STAFF) +#define IsDeveloper(x) ((x)->flags & AFLAG_DEVELOPER) +#define IsSupport(x) ((x)->flags & AFLAG_SUPPORT) +#define IsAdmin(x) ((x)->flags & AFLAG_ADMIN) +#define IsOperFlag(x) ((x)->flags & AFLAG_OPER) + +#define SetStaff(x) ((x)->flags |= AFLAG_STAFF) +#define SetDeveloper(x) ((x)->flags |= AFLAG_DEVELOPER) +#define SetSupport(x) ((x)->flags |= AFLAG_SUPPORT) +#define SetAdmin(x) ((x)->flags |= AFLAG_ADMIN) +#define SetOperFlag(x) ((x)->flags |= AFLAG_OPER) + +#define ClearStaff(x) ((x)->flags &= ~AFLAG_STAFF) +#define ClearDeveloper(x) ((x)->flags &= ~AFLAG_DEVELOPER) +#define ClearSupport(x) ((x)->flags &= ~AFLAG_SUPPORT) +#define ClearAdmin(x) ((x)->flags &= ~AFLAG_ADMIN) +#define ClearOperFlag(x) ((x)->flags &= ~AFLAG_OPER) typedef struct host { sstring *name; @@ -134,7 +134,7 @@ typedef struct nick { sstring *sethost; sstring *opername; flag_t umodes; - char authname[ACCOUNTLEN+1]; + char *authname; authname *auth; /* This requires User ID numbers to work */ time_t timestamp; time_t accountts; diff --git a/nick/nickhandlers.c b/nick/nickhandlers.c index 8d78e8d7..7118601e 100644 --- a/nick/nickhandlers.c +++ b/nick/nickhandlers.c @@ -148,7 +148,7 @@ int handlenickmsg(void *source, int cargc, char **cargv) { np->umodes=0; np->marker=0; memset(np->exts, 0, MAXNICKEXTS * sizeof(void *)); - np->authname[0]='\0'; + np->authname=NULL; np->auth=NULL; np->accountts=0; if(cargc>=9) { @@ -167,24 +167,22 @@ int handlenickmsg(void *source, int cargc, char **cargv) { sethostarg++; if ((accountts=strchr(cargv[accountarg],':'))) { - time_t accountts_t=strtoul(accountts,&accountid,10) *accountts++='\0'; + np->accountts=strtoul(accountts,&accountid,10); if(accountid) { - strncpy(np->authname,cargv[accountarg],ACCOUNTLEN); - np->authname[ACCOUNTLEN]='\0'; - np->accountts=accountts_t; - userid=strtoul(accountid + 1,&accountflags,10); - if(!userid) { - np->auth=NULL; - } else { + if(userid) { np->auth=findorcreateauthname(userid, cargv[accountarg]); + np->authname=np->auth->name; np->auth->usercount++; np->nextbyauthname=np->auth->nicks; np->auth->nicks=np; if(accountflags) np->auth->flags=strtoul(accountflags + 1,NULL,10); } + } else { + np->authname=malloc(strlen(cargv[accountarg]) + 1); + strcpy(np->authname,cargv[accountarg]); } } } @@ -400,14 +398,14 @@ int handleaccountmsg(void *source, int cargc, char **cargv) { accountts=strtoul(cargv[2],NULL,10); userid=strtoul(cargv[3],NULL,10); - if(cargv>=5) + if(cargc>=5) accountflags=strtoul(cargv[4],NULL,10); /* allow user flags to change if all fields match */ if (IsAccount(target)) { void *arg[2]; - if (!target->auth || strcmp(target->authname,cargv[1]) || (target->auth->userid != userid) || (target->accountts != accountts)) { + if (!target->auth || strcmp(target->auth->name,cargv[1]) || (target->auth->userid != userid) || (target->accountts != accountts)) { return CMD_OK; } @@ -424,15 +422,16 @@ int handleaccountmsg(void *source, int cargc, char **cargv) { } SetAccount(target); - strncpy(target->authname,cargv[1],ACCOUNTLEN); - target->authname[ACCOUNTLEN]='\0'; target->accountts=accountts; if(!userid) { target->auth=NULL; + target->authname=malloc(strlen(cargv[1]) + 1); + strcpy(target->authname,cargv[1]); } else { target->auth=findorcreateauthname(userid, target->authname); target->auth->usercount++; + target->authname=target->auth->name; target->nextbyauthname = target->auth->nicks; target->auth->nicks = target; if (cargc>=5) diff --git a/ticketauth/ticketauth.c b/ticketauth/ticketauth.c index dd24e5ec..99de1260 100644 --- a/ticketauth/ticketauth.c +++ b/ticketauth/ticketauth.c @@ -13,6 +13,7 @@ #include "../localuser/localuser.h" #include "../core/hooks.h" #include "../irc/irc.h" +#include "../chanserv/chanserv.h" #define WARN_CHANNEL "#twilightzone" @@ -22,7 +23,7 @@ sstring *sharedsecret = NULL; int ta_ticketauth(void *source, int cargc, char **cargv) { nick *np = (nick *)source; - char buffer[1024], *uhmac, *acc, *junk; + char buffer[1024], *uhmac, *acc, *junk, *flags; unsigned char digest[32]; int expiry, acclen, id; hmacsha256 hmac; @@ -33,15 +34,16 @@ int ta_ticketauth(void *source, int cargc, char **cargv) { return CMD_ERROR; } - if(cargc != 5) + if(cargc != 6) return CMD_USAGE; acc = cargv[0]; expiry = atoi(cargv[1]); id = atoi(cargv[2]); acclen = strlen(acc); - junk = cargv[3]; - uhmac = cargv[4]; + flags = cargv[3]; + junk = cargv[4]; + uhmac = cargv[5]; if((acclen <= 1) || (acclen > ACCOUNTLEN)) { controlreply(np, "Bad account."); @@ -76,7 +78,7 @@ int ta_ticketauth(void *source, int cargc, char **cargv) { controlreply(np, "Ticket valid, authing. . ."); - localusersetaccountflags(np, acc, id, 0, 0); + localusersetaccount(np, acc, id, 0, cs_accountflagmap_str(flags)); controlreply(np, "Done."); return CMD_OK;