[comp.sys.atari.st] password program/source

lean@sbcs.sunysb.edu (Lean L. Loh) (07/24/88)

Here's a little program which i put in my HD auto folder.  All it does is
prompt the user for a loginame and password.  The loginame is not used at
all. Only the password is used for verification.  The program will not
terminate until the correct password is entered.  Hence, one can use it to
prevent unauthorized access to one's ST.  Of course, one can always boot
from the floppy drive.

Both source code and executables are included. As one can see, i've set up
two passwords:  a) atari!   b) guest!
One can use a HEX editor to re-edit those two passwords in the executables.
The two passwords can be found at the end of line 19 and at beginning of
line 20 of the executables.  The source code could be better, but .....
Also, I'm posting it here since it's so small.  :-)


/*   Use at your own risk.  Author/poster will not be responsible in any
     way for any consequence of using this program.
*/

#include <osbind.h>
#define passwd1 "atari!"		/*  your password  */
#define passwd2 "guest!"		/*  for your guests? */
#define       LINEFEED    10
#define       RETURN      13
#define       TRUE	 1
#define	      FALSE      0
#define       MAX	16		/*  max length for password  */
main()
{
char word[MAX];
               
	Cconws("\33E\33e\r\n");	   /* clear screen, enable cursor, skipline */
	do
	{
	  Cconws( "login: " );
	  getword( word, TRUE );
	  Cconws( "Password: ");
	  getword( word, FALSE );
	  if ( strcmp( word, passwd1 ) == 0 )
			exit(0);
	  else
		if ( strcmp( word, passwd2 ) == 0 )
			exit( 0 );
		else
			{
			Cconws("Login incorrect\n\r");
			Cconout(7);		/* ring bell */
			}
	}  while (TRUE);
}
	
getword( str, echo )
char *str;
int echo;
{
char ch;
int i;
long int lret;

  i = 0; 
  do
  {
	if ( Cconis() != 0 )	    /* keyboard char available  */
        {
	     lret = Crawcin();	    /* get raw char from keyboard */
             ch = lret & 0x00ff;    /* Mask off everything but the low byte */
	     if (echo)
		 Cconout( ch );	    /* echo if requested */

	     if ( ch !=  RETURN )
	     {
		        if (i < MAX)
			{
				str[i] = ch;
				i++;
			}
	     }
	     else
			str[i] = '\0';
	 }
   } while ( ch != RETURN );

   Cconout( LINEFEED );
   Cconout( RETURN );
}

==============================
table
 !"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
begin 644 forpost.prg
M8!H   1F    @                        "IO  0@;0 8T>T '"1M "Q"z
M@")(2A)G4"**)DHD64H:9OPBBDH29SP,&P!!9NP,&P!29N8,&P!'9N ,&P!6y
M9MH,&P ]9@I*$V<&(\L   2^0ID@"2**)DHD64H:9OPBBDH29O(F &8R0ID@x
M"2+\   $X$7M ( 4&DB"0C(@ '(@%!IG%K0!9_A32B+*%!IG"K0!9OA"*O__w
M8.9"F2()T_D   3B(\$   3B+DDK20 $+PTCR   !( O""\ DH#D@5-!/P&3v
MS2\)+PU"9S\\ $I.0=[\  Q*@V8N/SP !#\\  ).N0   JH^@$ZY   "^#]\u
M  (  D)73KD   *J/H!.N0   OA83YS.3KD   $BWOP "C\ 3KD   )T/SP t
M3$Y!3E;_\"\\   $A' )/P!.05Q/+SP   2+< D_ $Y!7$]P 3\ 2&[_\$ZYs
M   !R%Q/+SP   23< D_ $Y!7$]"9TAN__!.N0   <A<3R\\   $GDAN__!.r
MN0   EQ03TI 9@Q"9TZY   "=%1/8*0O/   !*5(;O_P3KD   )<4$]*0&?>q
M+SP   2L< D_ $Y!7$]P!S\ < (_ $Y!6$]@ /]R3EY.=4Y6__A";O_\< L_p
M $Y!5$]*@&=<< <_ $Y!5$\M0/_X("[_^ *     _QU __Y*;@ ,9Q 0+O_^o
M2( _ ' "/P!.05A/#"X #?_^9QH,;@ 0__QL'#!N__S1[@ ($*[__E)N__Q@n
M"C!N__S1[@ (0A ,+@ -__YFD' */P!P C\ 3D%83W -/P!P C\ 3D%83TY>m
M3G4B;P $(&\ "! 9D!!F!$H89O9(@$C 3G5.5@  3KD   *./RX "$ZY   "l
MEE1/3EY.=4Y6  !.7DYU3E8  #\N  AP3#\ 3D%83TY>3G5.5O_\+P<_+@ (k
M<$4_ $Y!6$\^ &P0, =(P"\ 3KD   1$6$]@(C\N  A.N0   U!43SU   AMj
M#C\N  @_!TZY   #J%A/, <N'TY>3G5.5O_\+P<_+@ (/RX "G)&/P%.05Q/i
M/@!*0&8H/RX "$ZY   #4%1//4  "&T6/RX "#\N  I.N0   ZA83S N  I@h
M#C '2, O $ZY   $1%A/+A].7DYU3E;_^$C7(( ^+@ (, =60 Q   )B'.5(g
M,$#1_   !&8@4$[08"IP4& F<$%@(G!#8!Y*1VT.*GD   2^4T=M"$H=9OAPf
M_V (2A5G^! 52(!,UR" 3EY.=4Y6__A(UR" /BX "$I';0XJ>0  !+Y31VT(e
M2AUF^'#_8 I*%6?X,"X "AJ 3-<@@$Y>3G5.5O_X2-<@@#XN  @P!U9 #$  d
M F)(Y4@P0-'\   $<B!03M J>0  !+X0%4B L$=G#$H59@1PW6 F4HU@[" -c
MD+D   2^/P!.N0   JI43V .?D-@SGY!8,I^4&#&<-M,UR" 3EY.=4Y6  !*b
MK@ (;! @+@ (1( SP   !'YP_V $("X "$Y>3G4   -V   #>@   WX   0Va
M   $,@  !"X        ;11ME#0H ;&]G:6XZ( !087-S=V]R9#H@ &%T87)Iz
M(0!G=65S="$ 3&]G:6X@:6YC;W)R96-T"@T    $PD-#05 _/S\_/S\_/S\_y
M/S\_/S\_/S\_/S\_/S\        (     $PB,@8., @." H,$ X6"!0("@X*x
M"@S2"D0.%# 6%"@<,CX*' @P$ 0$! 0$1  ' 1 !"@ P    9@0         w
M    &    &@              (P!          !M86EN7P              v
M$    "(!97)R;F]?             !0   !^!%]S=&MS:7IE7P         4u
M    X@1?9V5T9FAT>7!E7P      $    % #7V-M9&YA;65?         !0 t
M  #@!%]A;&EA<V9H7P         0    W -E>&ET7P              $   s
M '0"7W-E=&9H='EP95\      !    "H V1U<#)?               0    r
M^ )G971W;W)D7P          $    ,@!96YV:7)O;E\          !0   " q
M!&1U<%\                0    J@)?:6]V96-T;W)?        %    +X$p
M7W-T87)T7P           !       %]S971E<G)N;U\        0    1 1?o
M97AI=%\             $    )8"<W1R8VUP7P           !    !< E]Fn
4:6YI<VA?           0    C@("m
 l
end

-- 
if you can dream it, you can do it.  			 CSNET:lean@sbcs.csnet
... go sleep			      ARPA:lean%suny-sb.csnet@csnet-relay.arpa
			      UUCP:{allegra, hocsd, philabs, ogcvax}!sbcs!lean