RE: Questions about FORK.

"Rainer Roomet" <[email protected]> Tue, 15 Aug 2006 19:31:19 +0000
Newsgroups gmane.games.devel.mud.rom
Message-ID <[email protected]>
Hello!

My mail is quite offtopic and it's not including any kind of solution but I 
have one question - why you building that kind of feature?

Hmm.. prolly to avoid multi-account but in the muds there are two different 
type players - cheaters and no cheaters :) And if anyone wanna cheat 
(multiplay, spying for example) he just creating a new account and he would 
be very foul player, if he start using same email as his/her original 
account have.

My MUD having account system and not any kind of change needed - if anyone 
multi-accounting (even account without any character) and we catch him/her - 
then all of his characters and accounts will be nuked.


Rainer Roomet
Phone: (+372) 58133281
Mail/MSN: [email protected]





>From: "Valnir" <[email protected]>
>To: <[email protected]>
>Subject: Questions about FORK.
>Date: Tue, 15 Aug 2006 12:35:56 -0400
>
>Ok.. I'm working on an account system, and want to make sure that no two 
>accounts have the same email address. Don't want users having duplicate 
>accounts. The issue I'm having is that during account creation I'm scanning 
>all the existing user accounts to see if any have the same address. I'm 
>using fork() so that I don't have the entire mud come to a screeching halt 
>while it scans, but for some reason, although everything in the fork() 
>seems to be working fine, it doesn't set the d->connected correctly or 
>process the nanny function again at the end the way I'm wanting it to. 
>Ideas? Thansk!
>
>- Valnir
>
>/* Code snippet */
>
>void check_dup_email ( DESCRIPTOR_DATA *d, char *email )
>{
>    DIR *user_dir;
>    struct dirent *users;
>    USER_DATA *usr;
>    char name[MIL];
>    char buf[MSL];
>    bool duplicate = FALSE;
>    int f;
>
>    if ( ( f = fork() ) == (-1) )
>    {
>        write_to_buffer( d, "\n\r\n\r", 0 );
>        write_to_buffer( d, "An error occured while trying to validate your 
>email address!\n\r", 0 );
>        write_to_buffer( d, "You will not be able to complete continue 
>creating your account\n\r"
>            "until this problem is solved. The staff has been 
>contacted.\n\r\n\r"
>            "Please check back soon!\n\r\n\r"
>            "^e[^fPress Return to Disconnect^e]^0\n\r", 0 );
>
>        d->connected = CON_USER_DISCONNECT;
>        bug( "fork() failed in check_dup_email.", 0 );
>        do_bug( NULL, "fork() failed in check_dup_email." );
>        return;
>    }
>
>    if ( !f )
>    {
>        write_to_buffer( d, "Please wait while we scan for duplicate 
>accounts.", 0 );
>        process_output( d, FALSE );
>
>        if ( ( user_dir = opendir(USER_DIR) ) != NULL )
>        {
>            while ( ( users = readdir(user_dir) ) != NULL )
>            {
>                write_to_buffer( d, ".", 0 );
>
>                if ( !str_cmp( users->d_name, "." )
>                || !str_cmp( users->d_name, ".." ) )
>                    continue;
>
>                if ( !strstr( users->d_name, ".usr" ) )
>                    continue;
>
>                /* get name from file filename - still need to parse the 
>'.usr' off the filename */
>
>                if ( ( usr = load_account( NULL, name ) ) != NULL )
>                {
>                    if ( !str_cmp( usr->email, email ) )
>                    {
>                        sprintf( buf, "Attempt to use duplicate email 
>address detected. "
>                            "Same as '%s'.", usr->name );
>                        log_string( buf );
>                        duplicate = TRUE;
>                    }
>                }
>
>                unload_account( NULL, usr);
>                process_output( d, FALSE );
>
>                if ( duplicate )
>                    break;
>            }
>        }
>        else
>            bug( "Could not open USER_DIR!", 0 );
>
>        closedir( user_dir );
>        write_to_buffer( d, "\n\r\n\r", 0 );
>
>        if ( duplicate )
>        {
>            write_to_buffer( d, "Duplicate email found! We do not allow 
>multiple accounts\n\r"
>                "per player. If you have forgotten your account name, 
>please contact\n\r"
>                "the staff at http://www.legendofthenobles.com/?page=email 
>to request\n\r"
>                "your account name.\n\r\n\r"
>                "^e[^fPress Return to Disconnect^e]^0\n\r", 0 );
>
>            process_output( d, TRUE );
>            d->connected = CON_USER_DISCONNECT;
>        }
>        else
>        {
>            write_to_buffer( d, "No duplicate found.\n\r", 0 );
>            process_output( d, TRUE );
>
>            d->connected = CON_CONFIRM_EMAIL;
>            nanny( d, email );
>        }
>
>        exit(0);
>    }
>
>    return;
>}
>
>--
>ROM mailing list
>[email protected]
>Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

-- 
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom