A
download b_passwo.cpp
Language: C++
Copyright: Copyright 1987, Wynn Wagner III. The original Copyright 1987-96, Bit Bucket Software Co.
LOC: 82
Project Info
BinkleyTerm XE(btxe)
Server: SourceForge
Type: cvs
...e\b\btxe\btxe\btnt\sources\
   Addr.cpp
   Addr.h
   aglcrc.cpp
   aglcrc.h
   asyn_lnx.cpp
   asyn_os2.cpp
   asyn_w32.cpp
   async.h
   asyos2v1.h
   b_banner.cpp
   b_bbs.cpp
   b_faxrcv.cpp
   b_flofil.cpp
   b_frproc.cpp
   b_help.cpp
   b_initva.cpp
   b_logs.cpp
   b_passwo.cpp
   b_proto.cpp
   b_rspfil.cpp
   b_sbinit.cpp
   b_script.cpp
   b_search.cpp
   b_sessio.cpp
   b_spawn.cpp
   b_term.cpp
   b_termov.cpp
   b_today.cpp
   b_wazoo.cpp
   b_whack.cpp
   b_wzsend.cpp
   banner.cpp
   banner.h
   BasicString.h
   bbs_ctra.cpp
   bbs_data.cpp
   bbs_incl.h
   bbs_io.cpp
   bink.h
   bink_asm.cpp
   binkdlg.cpp
   binkpipe.h
   box.h
   brec.cpp
   bsend.cpp
   bt.cpp
   btconfig.cpp
   btutil.cpp
   buffer.h
   cache.cpp
   cache.h
   callback.cpp
   callerid.cpp
   callwin.cpp
   callwin.h
   capi.cpp
   cfosline.cpp
   chat.cpp
   com.h
   com_dos.h
   com_lnx.h
   com_os2.h
   com_w32.h
   common.cpp
   cpuload.cpp
   css.cpp
   css.h
   data.cpp
   debug.cpp
   debug.h
   defines.h
   dosfuncs.cpp
   emsi.cpp
   emxmxcom.cpp
   evtparse.cpp
   evtsetup.cpp
   exceptio.cpp
   exceptio.h
   Exceptions.cpp
   Exceptions.h
   externs.h
   faxproto.h
   fcfgread.cpp
   fidomail.h
   file_all.cpp
   file_dos.cpp
   file_io.h
   file_lnx.cpp
   file_os2.cpp
   file_w32.cpp
   foffsets.h
   fossil.cpp
   freepoll.cpp
   ftsc.cpp
   gethcomm.h
   heap.cpp
   history.cpp
   history.h
   hydra.cpp
   hydra.h
   includes.cpp
   includes.h
   janus.cpp
   janus.h
   keybd.h
   keyfncs.h
   keymap.cpp
   langload.cpp
   language.h
   lngmagic.h
   m7rec.cpp
   m7send.cpp
   mailer.cpp
   mailovly.cpp
   mailroot.cpp
   maxcomm.h
   maxmcp.cpp
   maxmcp.h
   maxprm.cpp
   mdm_proc.cpp
   misc.cpp
   msgs.h
   Node.cpp
   Node.h
   NodeList.cpp
   NodeList.h
   nodeproc.cpp
   os2_pm.cpp
   outbound.cpp
   pipe.cpp
   pktmsgs.cpp
   pktmsgs.h
   protcomm.cpp
   prototyp.h
   recvbark.cpp
   recvsync.cpp
   sbuf.cpp
   sbuf.h
   sched.cpp
   sched.h
   script2.cpp
   SelfTest.cpp
   SelfTest.h
   sendbark.cpp
   sendsync.cpp
   squish.cpp
   squish.h
   srif.cpp
   statetbl.cpp
   stats.cpp
   stdafx.cpp
   stdafx.h
   timer.cpp
   timer.h
   times.cpp
   types.h
   v7debug.cpp
   version.cpp
   version7.cpp
   version7.h
   vfos_dos.cpp
   vfos_lnx.cpp
   vfos_os2.cpp
   vfos_qnx.cpp
   vfos_w32.cpp
   vfossil.h
   video.h
   vt100.cpp
   vt100.h
   xfer.h
   xmrec.cpp
   xmsend.cpp
   xstring.h
   yoohoo.cpp
   zmodem.cpp
   zmodem.h

/*---------------------------------------------------------------------------*
 *
 *                               BinkleyTerm
 *
 *              (C) Copyright 1987-96, Bit Bucket Software Co.
 *     For license and contact information see /doc/orig_260/license.260.
 *
 *           This version was modified by the BinkleyTerm XE Team.
 *        For contact information see /doc/team.lst and /doc/join.us.
 *  For a complete list of changes see /doc/xe_user.doc and /doc/xe_hist.doc.
 *
 * Filename    : $Source: /cvsroot/btxe/btnt/sources/b_passwo.cpp,v $
 * Revision    : $Revision: 1.1 $
 * Tagname     : $Name:  $
 * Last updated: $Date: 2005/01/01 15:18:11 $
 * State       : $State: Exp $
 * Orig. Author: Wynn Wagner III
 *
 * Description : BinkleyTerm Password Processor
 *
 * Note        :
 *   This module is based largely on a similar module in OPUS-CBCS V1.03b.
 *   The original work is (C) Copyright 1987, Wynn Wagner III. The original
 *   author has graciously allowed us to use his code in this work.
 *
 *---------------------------------------------------------------------------*/

/* Include this file before any other includes or defines! */

#include "includes.h"

static char *LOCALFUNC strnpbk (char *, int);

/*--------------------------------------------------------------------------*/
/* N PASSWORD                                                               */
/*--------------------------------------------------------------------------*/

int
n_password (ADDR * rem_addrp, char *theirs, char *ours, int *logit)
{
    int got_one;
    char s_ours[9], s_theirs[9];

    if ((ours != NULL) && (ours[0]))
    {
        got_one = 2;

        if ((theirs != NULL) && (theirs[0]))
        {
            got_one = 1;

            strnpbk (theirs, 8);      /* Get rid of trailing blanks */
            strnpbk (ours, 8);

            if (!strnicmp (theirs, ours, 8))
            {
                /* If this is the first time, we'll log it.
                 * Otherwise, forget it.
                 */

                if (*logit)
                {
                    status_line (MSG_TXT (M_PROTECTED_SESSION));
                    *logit = FALSE;
                    is_protected = 1;     /* mtt 96-04-28 */
                }
                return 0;
            }
        }

        strntcpy (s_ours, ours, 9);
        strntcpy (s_theirs, theirs, 9);

        status_line (MSG_TXT (M_PWD_ERROR),
                     Full_Addr_Str (rem_addrp),
                     s_theirs,      /* TJW 960427 removed PW trash bug if len(pw)=8 */
                     s_ours);       /* TJW 960427 removed PW trash bug if len(pw)=8 */

        return got_one;
    }
    return 0;
}

/*--------------------------------------------------------------------------*/
/* N GET PASSWORD                                                           */
/* Find the nodelist entry for this system and point remote_password at     */
/* its password if any                                                      */
/*--------------------------------------------------------------------------*/

int
n_getpassword (ADDR* pw_addr)
{
    int i;

    remote_password = NULL;       /* Default to no password   */
    newnodedes.Password[0] = '\0';

    remote_password = PasswordFromFile (pw_addr);  /* r. hoerner  */

#ifdef USE_FIDOCONFIG
    if (remote_password == NULL)
        remote_password = PasswordFromFidoconfig (pw_addr);
#endif

    i = nodefind (pw_addr, 0);    /* find the node in the list */
    if (i <= 0)                   /* and fills newnodedes-struc */
    {
        /* remote_password = NULL; */

        /* if a node or point exists in my password file, then he is at least "KNOWN" */
        CURRENT = (newnodedes.Password[0] ? PROT : KNOWN);
        return (i);                 /* return failure if can't  */
    }

    is_listed = i;                /* mtt 96-04-28 */

    if (remote_password)          /* as taken from password file, r. hoerner */
        memcpy (newnodedes.Password, remote_password, 8);  /* MR 970717 memcpy! */

    if (newnodedes.Password[0] != '\0')  /* If anything there,       */
    {
        remote_password = (char *) (&newnodedes.Password[0]);  /* Point at it */
        CURRENT = PROT;
        return (1);                 /* Successful attempt       */
    }
    else
    {
        /* No password involved */
        return (0);
    }
}

/*
 * Strip all trailing blanks from a record.
 */

static char *LOCALFUNC
strnpbk (register char *string, register int n)
{
    string += n;                  /* point past end of string */
    while (n--)                   /* now keep count */
    {
        if (*--string)              /* if there's a character   */
        {
            if (*string != ' ')       /* if not a blank, we exit  */
                break;
            *string = '\0';           /* if blank, terminate here */
        }
    }
    return string;
}

/* $Id: b_passwo.cpp,v 1.1 2005/01/01 15:18:11 vildanov Exp $ */

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us