[IRCServices] what do they think ?
Andrew Kempe
andrewk at icon.co.za
Fri Oct 8 02:42:27 PDT 1999
I have little experience with system(), but from what I've heard, it's not
such a good command to use. execve() being a more preferred method. Am I
correct?
This type of functionality is already being build into the next version of
IRC Services.
Andrew
On Thu, 7 Oct 1999, root of all evil wrote:
> i had wrote this function on my services, it is working well, but i wold like
> to hear coments and sugestions on it
>
> it send password information to the nick email (ni->email) and i changed the
> do_register, so users must give a mail
>
> the function is it :
>
> static void do_sendpass(User *u)
> {
> #ifndef USE_ENCRYPTION
> char *nick = strtok(NULL, " ");
> NickInfo *ni;
> FILE *tosend;
> FILE *lock;
> #endif
>
> #ifdef USE_ENCRYPTION
> notice(s_NickServ, u->nick, "SENDPASS not avaliable");
> #else
> lock = fopen(".senpass.nick", "r");
> if (lock) {
> notice(s_NickServ, u->nick, "Sendpass is busy, try again later");
> fclose(lock);
> return ;
> }else if (!nick) {
> notice(s_NickServ, u->nick, "Sintax: /msg NickServ SENDPASS nick");
> return ;
> } else if (!(ni = findnick(nick))) {
> notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, nick);
> return ;
> } else if (nick_is_services_admin(ni) && !is_services_root(u)) {
> notice_lang(s_NickServ, u, PERMISSION_DENIED);
> return ;
> } else if (!ni->email) {
> notice(s_NickServ, u->nick, "No email set");
> return ;
> } else if (!strchr(ni->email, '@')) {
> notice(s_NickServ, u->nick, "bad email");
> return ;
> } else if(strlen(ni->email)>50) {
> notice(s_NickServ, u->nick, "bad email");
> return ;
> } else {
>
> char illsend[256];
> strcpy(illsend,"/usr/sbin/sendmail ");
> strcat(illsend, ni->email);
> strcat(illsend," < .sendpass.nick");
>
> tosend = fopen(".sendpass.nick", "w");
> if (tosend) {
> fprintf(tosend, "From: brasirc at brasirc.com.br\n");
> fprintf(tosend, "Subject: [%s] Password\n", ni->nick);
> fprintf(tosend, "\n");
> fprintf(tosend, "Dear user\n");
> fprintf(tosend, "yor nick %s password is:%s\n", ni->nick, ni->pass);
> fprintf(tosend, "if u need help write to ajuda at brasirc.com.br\n");
> fprintf(tosend, "or join #BrasIRCOP\n");
> fprintf(tosend, "\n");
> fprintf(tosend, "BrasIRC.com.br network");
> fprintf(tosend,".\n"); /* this get us out on sendmail */
> fclose(tosend);
>
> system(illsend);
> system("rm -f .sendpass.nick");
>
> log("%s: %s!%s@%s used SENDPASS on %s email: %s", s_NickServ, u->nick,
> u ->username, u->host, nick, ni->email);
> if (WallGetpass)
> wallops(s_NickServ, "\2%s\2 used SENDPASS on \2%s\2, mail: %s",
> u->nick, nick, ni->email);
> } else { notice(s_NickServ, u->nick, "Ooops, Something gone
> wrong on SendPass");
> } }
> }
> #endif
>
> Fighter ircadmin irc.rionet.com.br
> Brasirc.com.br Network
> ---------------------------------------------------------------
> To unsubscribe, send email to majordomo at ender.shadowfire.org
> with "unsubscribe ircservices" in the body, without the quotes.
>
---------------------------------------------------------------
To unsubscribe, send email to majordomo at ender.shadowfire.org
with "unsubscribe ircservices" in the body, without the quotes.