From 7df7823042150f212fcbb00ab863a71c6c953064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20GIBERT?= Date: Wed, 17 Apr 2019 07:22:23 +0100 Subject: [PATCH] Kernel 0.93 --- BIN/USERADD.S.txt | 84 ++++++++++++++++++++++++++++++++++++------- BIN/WHO.S.txt | 4 +-- INC/KERNEL.I.txt | 2 +- SBIN/LOGIN.S.txt | 17 +++++---- SYS/KERNEL.S.CORE.txt | 2 +- SYS/KERNEL.S.INIT.txt | 4 +-- 6 files changed, 86 insertions(+), 27 deletions(-) diff --git a/BIN/USERADD.S.txt b/BIN/USERADD.S.txt index a26ac520..fc0d0fd5 100644 --- a/BIN/USERADD.S.txt +++ b/BIN/USERADD.S.txt @@ -19,11 +19,13 @@ PASS.MAX .EQ 64 ZS.START ZPPWPtr .BS 2 ZPhPW .BS 1 -ZPStrPtr .BS 2 ZPhStr .BS 1 ZPbStrSecret .BS 1 ZPStrLen .BS 1 ZPStrMax .BS 1 +ArgCount .BS 1 +ArgUsername .BS 1 +ZPStrPtr .BS 2 ZS.END .ED *-------------------------------------- * File Header (16 Bytes) @@ -52,6 +54,7 @@ L.MSG.ROOTPWD1 .DA MSG.ROOTPWD1 L.MSG.ROOTPWD2 .DA MSG.ROOTPWD2 L.MSG.MISMATCH .DA MSG.MISMATCH L.MSG.BS .DA MSG.BS +L.MSG.CRLF .DA MSG.CRLF .DA 0 *-------------------------------------- * Called once at process creation @@ -87,23 +90,20 @@ CS.RUN >LDYAI S.PW jmp CS.RUN.ROOT -.1 - +.1 jsr CS.RUN.CheckArg + bcs .99 + >PUSHBI 0 >LDYA L.MSG.USAGE >SYSCALL printf -.8 lda #0 - sec - rts - -.9 lda #E.SYN + lda #E.SYN sec .99 rts *-------------------------------------- CS.RUN.ROOT ldy #0 -.1 lda ROOT.PW,y +.1 lda PW.ROOT,y sta (pData),y PW iny cpy #S.PW @@ -161,7 +161,6 @@ CS.RUN.ROOT ldy #0 *-------------------------------------- CS.RUN.GetStr stz ZPStrLen - .1 >SYSCALL getchar bcs .9 @@ -207,10 +206,59 @@ CS.RUN.GetStr stz ZPStrLen lda #0 sta (ZPStrPtr),y - clc + >PUSHBI 0 + >LDYA L.MSG.CRLF + >SYSCALL printf .9 rts *-------------------------------------- +CS.RUN.CheckArg +.1 inc ArgCount + lda ArgCount + >SYSCALL ArgV + bcs .8 + >STYA ZPStrPtr + + lda (ZPStrPtr) + cmp #'-' + bne .4 + + ldy #1 + lda (ZPStrPtr),y + ldx OptionList + +.2 cmp OptionList,x + beq .3 + dex + bne .2 + + lda #E.SYN + sec + rts + +.3 ldy OptionVars-1,x + lda #$80 + sta (pData),y + bra .1 + +.4 lda ArgUsername + bne .9 + + ldy #$ff + +.5 iny + lda (ZPStrPtr),y + sta + + + lda ArgCount + sta ArgUsername + bra .1 + +.9 lda #E.SYN + sec + rts +*-------------------------------------- * Called if option S.PS.F.EVENT enabled in Header * Timer Event : every 10th seconds *-------------------------------------- @@ -240,6 +288,8 @@ CS.QUIT lda ZPhStr *-------------------------------------- CS.END *-------------------------------------- +OptionList >PSTR "CDPScdps" +*-------------------------------------- * Initialized DATA *-------------------------------------- LIBCRYPT .AZ "libcrypt" @@ -256,7 +306,7 @@ MSG.ROOTPWD2 .AZ "\r\nPlease retype ROOT password : " MSG.MISMATCH .AZ "\r\nPasswords mismatch...\r\n" MSG.BS .DA #C.BS,#C.SPACE,#C.BS,#0 *-------------------------------------- -ROOT.PW .AS "ROOT" +PW.ROOT .AS "ROOT" .BS 17-4 .BS 33 PASSWD .DA #0 UID @@ -268,6 +318,16 @@ ROOT.PW .AS "ROOT" .AS "${ROOT}BIN/SH" .BS 65-13 *-------------------------------------- +PW.DEFAULT .BS 17 NAME + .BS 33 PASSWD + .DA #0 UID + .DA #0 GID + .BS 65 GECOS + .AS "${ROOT}USR/" + .BS 65-11 + .AS "${ROOT}BIN/SH" + .BS 65-13 +*-------------------------------------- * Per Process DATA segment *-------------------------------------- .DUMMY diff --git a/BIN/WHO.S.txt b/BIN/WHO.S.txt index fa734f69..b3bd072e 100644 --- a/BIN/WHO.S.txt +++ b/BIN/WHO.S.txt @@ -50,7 +50,7 @@ CS.RUN >LDYA L.MSG0 ldx #1 stx USRID -.1 lda S.Table.hPW-1,x +.1 lda S.Table.hSession-1,x beq .7 lda S.Table.hFile-1,x @@ -61,7 +61,7 @@ CS.RUN >LDYA L.MSG0 >PUSHYA ldx USRID - lda S.Table.hPW-1,x + lda S.Table.hSession-1,x >SYSCALL GetMemPtr >STYA ZPPWPtr diff --git a/INC/KERNEL.I.txt b/INC/KERNEL.I.txt index 235dccae..178ce686 100644 --- a/INC/KERNEL.I.txt +++ b/INC/KERNEL.I.txt @@ -21,7 +21,7 @@ PS.Table.Stats .EQ $13E0 K.PS.MAX OF.Table.hPath .EQ $1400 K.OF.MAX OF.Table.hFD .EQ $1420 K.OF.MAX *-------------------------------------- -S.Table.hPW .EQ $1440 K.USR.MAX +S.Table.hSession .EQ $1440 K.USR.MAX S.Table.hFile .EQ $1450 K.USR.MAX *-------------------------------------- A2osX.EndTables .EQ $1460 diff --git a/SBIN/LOGIN.S.txt b/SBIN/LOGIN.S.txt index 8db9a330..1495a40f 100644 --- a/SBIN/LOGIN.S.txt +++ b/SBIN/LOGIN.S.txt @@ -15,7 +15,6 @@ NEW .OR ZPBIN ZS.START ZPUsrID .BS 1 -ZPUsrPtr .BS 2 ZPShellPtr .BS 2 ZPRetryCnt .BS 1 @@ -169,7 +168,7 @@ CS.RUN.NOAUTH >PUSHBI 0 CS.RUN.EXEC ldx #1 -.1 lda S.Table.hPW-1,x +.1 lda S.Table.hSession-1,x beq .2 inx cpx #K.USR.MAX+1 @@ -185,9 +184,9 @@ CS.RUN.EXEC ldx #1 ldy #S.PS.hSID sta (pPS),y - txa + lda ZPhSID ldx ZPUsrID - sta S.Table.hPW-1,x + sta S.Table.hSession-1,x ldy #S.PS.hStdIn lda (pPS),y @@ -204,8 +203,8 @@ CS.RUN.EXEC ldx #1 >SLEEP ldx ZPUsrID - lda S.Table.hPW-1,x - stz S.Table.hPW-1,x + lda S.Table.hSession-1,x + stz S.Table.hSession-1,x stz S.Table.hFILE-1,x >SYSCALL freemem @@ -213,7 +212,7 @@ CS.RUN.EXEC ldx #1 *-------------------------------------- CS.RUN.SetRootSession >LDYA L.SESSION.ROOT - >STYA ZPUsrPtr + >STYA ZPStrPtr >LDYAI SESSION.ROOT.Size >SYSCALL getmem @@ -223,10 +222,10 @@ CS.RUN.SetRootSession ldy #SESSION.ROOT.Size-1 -.2 lda (ZPUsrPtr),y +.1 lda (ZPStrPtr),y sta (pSession),y dey - bpl .2 + bpl .1 * clc .9 rts diff --git a/SYS/KERNEL.S.CORE.txt b/SYS/KERNEL.S.CORE.txt index 6f1b9596..2c55daff 100644 --- a/SYS/KERNEL.S.CORE.txt +++ b/SYS/KERNEL.S.CORE.txt @@ -395,7 +395,7 @@ CORE.PSSelect ldy #S.PS.ZP+ZPBIN.SIZE-1 ldy #S.PS.hSID lda (pPs),y tax - lda S.Table.hPW-1,x + lda S.Table.hSession-1,x jsr K.GetmemPtr >STYA pSession diff --git a/SYS/KERNEL.S.INIT.txt b/SYS/KERNEL.S.INIT.txt index 4ce37862..e03d3d79 100644 --- a/SYS/KERNEL.S.INIT.txt +++ b/SYS/KERNEL.S.INIT.txt @@ -336,7 +336,7 @@ MemMgrInit >LDYAI Mem.MHiMem ldx #K.USR.MAX*2-1 -.6 stz S.Table.hPW,x +.6 stz S.Table.hSession,x dex bpl .6 @@ -1089,7 +1089,7 @@ PwdMgrInit >LDYAI MSG.PWD .1 >LDYAI PwdMgr.ROOT.Size jsr K.Getmem >STYA pSession - stx S.Table.hPW + stx S.Table.hSession ldy #PwdMgr.ROOT.Size-1