Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-11 - 43,50527/change.bli
There are no other files named change.bli in the archive.
Module Change(Entries=(Change),Reserve(1,2,3,4))=
Begin
	Require MACHOP.BLI;
	Require MACROS.BLI;
	Require EXTERN.BLI;
	External Finuname;
Global routine change(uname1,uname2)=
Begin

Own a,lub[4],enb[4],fob2[6],fob1[6],acct2[accmax],strptr,tmp,char,infloop;

If NOT prvbit(pvcall) OR (.uname1 EQL 0) then
Begin
	If .Uname1 NEQ 0 then
	Begin
		Print('?M?J?G??MAICAU You may not alter another user?M?J');
		Return 0;
	End;
	Uname1 _ .Acct[accnm1];
	Uname2 _ .Acct[accnm2];
End;

fob1[0]_Xwd(In,1);
fob1[1]_12;
fob1[2]_mlrdev;
fob1[3]_Xwd(0,ibufhdr);
fob1[4]_Xwd(0,-1);
fob1[5]_Address(Lub);

fob2[0]_Xwd(Out,3);
fob2[1]_12;
fob2[2]_mlrdev;
fob2[3]_Xwd(obufhdr,0);
fob2[4]_Xwd(-1,0);
fob2[5]_Address(enb);

filblock(lub,'.acct.',mlrext,#777^27,mlrppn);

filblock(enb,'.acct.',mlrext,#777^27,mlrppn);

reset;

Ac1 _ Xwd(6,address(fob1));
Ac2 _ Xwd(6,address(fob2));

Ifskip filop(ac1) then 
Begin
	If NOT Lockchn(in,1) then
	Begin
		Releas(in);
		Return;
	End;
End
else	Begin
	Print('?M?J?G??MAIUAF Unexpected error on accounting file?M?J');
	Error(.ac1);
	Return 0;
	End;
Ifskip filop(ac2) then 0 else
	Begin
	Print('?M?J?G??MAIUAF Unexpected error on accounting file?M?J');
	Error(.ac2);
	Releas(in);
	Return 0;
	End;

Begin
	acct2[accnm1]_infile("IN");
	acct2[accnm2]_infile("IN");
	Until Usern(.acct2[accnm1],.acct2[accnm2],.uname1,.uname2) OR (.acct2[accnm1] EQL "EOF") do
	Begin
		Outfile(.acct2[accnm1]);
		Outfile(.acct2[accnm2]);
		a _ Infile("IN");
		Until (.a EQL -1) OR (.a EQL "EOF") do
		Begin
			Outfile(.a);
			a _ Infile("IN");
		End;
		Outfile(.a);		! The -1 word
		acct2[accnm1] _ Infile("IN");
		acct2[accnm2] _ Infile("IN");
	End;
End;

If .Acct2[accnm1] EQL "EOF" then 
Begin
	Print('?M?J?G%Uname doesn''t exist?M?J');
	Close(IN);
	Close(Out);
	Releas(In);
	Releas(Out);
	Return 0;
End;

a _ accnm2 + 1;
tmp _ infile("IN");
until .tmp EQL -1 do 
	Begin
	acct2[.a]_.tmp;
	tmp _ infile("IN");
	a _ .a + 1;
	End;
acct2[.a]_-1;

While TRUE do
Begin
	Tmp _ 0;
	While (.tmp EQL 0) do
	Begin
		Print('ALTER> ');
		Tmp _ sixin(0,-6);
	End;
	If unique(.tmp,sixbit'UNAME',1) then
		If prvbit(pvcunm) then 
		Begin
			acct2[accnm1] _ sixin(.ac3,12);
			while .acct2[accnm1] EQL 0 do (Print('?M?JUname: ');acct2[accnm1] _ sixin(0,12));
			acct2[accnm2] _ (if .ac1 EQL 0 then .ac2 else 0);
		End
		Else Print('?G??MAIUAU You may not alter the uname?M?J')
	else If unique(.tmp,sixbit'NAME',1) then
		If prvbit(pvcnam) then
		Begin
			acct2[accus1] _ sixin(.ac3,12);
			If (.acct2[accus1] EQL 0) THEN
			BEGIN
				Print('Name for PPN: ');
				acct2[accus1] _ sixin(0,12);
			END;
			acct2[accus2] _ (if .ac1 EQL 0 then .ac2 else 0);
		End
		Else Print('?G??MAIUPN You may not alter the PPN name?M?J')
	else If unique(.tmp,sixbit'HELP',1) then
		Begin
			Print('?M?JCommands:?M?J');
			Tab; Print('Addgp	-	Add a group?M?J');
			Tab; Print('Del	-	Delete a user?M?J');
			Tab; Print('Exit	-	Exit change mode?M?J');
			Tab; Print('FDev	-	Change file device?M?J');
			Tab; Print('FExt	-	Change file extension?M?J');
			Tab; Print('FName	-	Change file name?M?J');
			Tab; Print('FUlln	-	Change full name?M?J');
			Tab; Print('Help	-	Print this messgae?M?J');
			Tab; Print('List	-	List this entry?M?J');
			Tab; Print('Name	-	Change PPN name?M?J');
			Tab; Print('PAss	-	Change password?M?J');
			Tab; Print('PPn	-	Change PPN?M?J');
			Tab; Print('PRiv	-	Change privword?M?J');
			Tab; Print('Quit	-	Abort changes?M?J');
			Tab; Print('Remgp	-	Remove a group?M?J');
			Tab; Print('Uname	-	Change uname?M?J');
		End
	else if unique(.tmp,sixbit'EXIT',1) then
		Begin
		Print('[Returning to MAILER]?M?J');
		a _ accnm1;
		tmp _ .acct2[.a];
		until .tmp EQL -1 do
		Begin
			outfile(.tmp);
			a _ .a + 1;
			tmp _ .acct2[.a];
		End;
		outfile(.tmp);	! Give the -1 word
		tmp _ infile("IN");
		Until .tmp EQL "EOF" do
		Begin
			outfile(.tmp);
			tmp _ infile("IN");
		End;
		Close(in);
		Close(out);
		Releas(in);
		Releas(Out);
		Finuname(.acct[accnm1],.acct[accnm2]);
		Return 0;
		End
	else if unique(.tmp,sixbit'ADDGP',1) then
		If prvbit(pvcgrp) then
		Begin
			a _ FALSE;
			tmp _ Sixin(.ac3,6);
			While (.tmp EQL 0) do
			Begin
				Print('Group: ');
				Tmp _ Sixin(0,6);
			End;
			Select .tmp of
			NSET
				.acct2[accgp1]:a _ true;
				.acct2[accgp2]:a _ true;
				.acct2[accgp3]:a _ true;
				.acct2[accgp4]:a _ true;
				.acct2[accgp5]:a _ true;
			TESN;
			If (.a) then Print('?G%Already a member of that group?M?J')
			else 
			Begin
				If (.acct2[accgp1] EQL 0) then acct2[accgp1]_.tmp
				else if (.acct2[accgp2] EQL 0) then acct2[accgp2]_.tmp
				else if (.acct2[accgp3]EQL 0) then acct2[accgp3]_.tmp
				else if (.acct2[accgp4]EQL 0) then acct2[accgp4]_.tmp
				else if (.acct2[accgp5]EQL 0) then acct2[accgp5]_.tmp
				else Print('?G%Maximum number of groups exceeded for this user?M?J');
			End;
		End
		Else Print('?G??MAICYG You may not change group information?M?J')
	else if unique(.tmp,sixbit'REMGP',1) then
		If prvbit(pvcgrp) then
		Begin
			tmp _ sixin(.ac3,6);
			While (.tmp EQL 0) do
			Begin
				Print('Group: ');
				Tmp _ Sixin(0,6);
			End;
			Select .tmp of
			NSET
				.acct2[accgp1]:acct2[accgp1] _ 0;
				.acct2[accgp2]:acct2[accgp2] _ 0;
				.acct2[accgp3]:acct2[accgp3] _ 0;
				.acct2[accgp4]:acct2[accgp4] _ 0;
				.acct2[accgp5]:acct2[accgp5] _ 0;
				otherwise:Print('?G%Not a member of that group?M?J');
			TESN;
		End
		Else Print('?G??MAICYG You may not change group information?M?J?M?J')
	else if unique(.tmp,sixbit'DEL',1) then
		if prvbit(pvcall) then
			if NOT Auser(.Acct2[accnm1],.Acct2[accnm2]) then
			Begin
				Print('?M?J[User deleted - Returning to MAILER]?M?J');
				tmp _ infile("IN");
				Until .tmp EQL "EOF" do
				Begin
					outfile(.tmp);
					tmp _ infile("IN");
				End;
				Close(in);
				Close(out);
				Releas(in);
				Releas(out);
				Return 0;
			End
			else print('?G??MAICDS You may not delete yourself!?M?J')
		else print('?G??MAICDS You may not delete yourself!?M?J')
	else if unique(.tmp,sixbit'QUIT',1) then
		Begin
		Print('?G??MAICGA Changes aborted?M?J');
		Reset;
		Return 0;
		End
	else if unique(.tmp,sixbit'FDEV',2) then 
		if prvbit(pvcdev) then
		Begin
			acct2[accmfd] _ sixin(.ac3,6);
			IF (.acct2[accmfd] EQL 0) then
			BEGIN
				Print('Disk: ');
				acct2[accmfd]_sixin(0,6);
			END;
		End
		Else Print('?G??MAICAD You may not alter the disk device?M?J')
	else if unique(.tmp,sixbit'FEXT',2) then
		if prvbit(pvcext) then
		Begin
			acct2[accmfe] _ sixin(.ac3,3);
			IF(.acct2[accmfe] EQL 0) THEN
			BEGIN
				Print('Extension: ');
				acct2[accmfe]_sixin(0,3);
			END;
		End
		Else Print('?G??MAICAE You may not alter the extension?M?J')
	else if unique(.tmp,sixbit'FNAME',2) then
		if prvbit(pvcfln) then
		Begin
			acct2[accmlf]_sixin(.ac3,6);
			IF(.acct2[accmlf] EQL 0) THEN
			BEGIN
				Print('Filename: ');
				acct2[accmlf]_sixin(0,6);
			END;
		End
		Else Print('?G??MAICAF You may not alter the filename?M?J')
	else if unique(.tmp,sixbit'FULLN',2) then
		if prvbit(pvcfnm) then
		Begin
			Print('The full name: ');
			acct2[accfnm] _ acct2[accfnm+1] _ 0;
			Rdtty(byteptr(address(acct2[accfnm])),30);
			a _ accfnm;
			until (.acct2[.a] EQL 0) do a _ .a + 1;
			acct2[.a+1] _ -1;
		End
		Else Print('?G??MAICFN You may not alter the full name?M?J')
	else if unique(.tmp,sixbit'PASS',2) then
		if prvbit(pvcpas) then
		Begin
			Print('Old password: ');
			Noecho();
			if (.acct2[accpas] NEQ sixin(0,6)) AND NOT prvbit(pvpass) then
				print('?G??MAIICP Incorrect password?M?J')
			else begin
				Print('New password: ');
				tmp_sixin(0,6);
				Print('Retype password: ');
				if .tmp NEQ sixin(0,6) then print('?G%Password not changed?M?J')
				else acct2[accpas] _ .tmp;
				end;
			Echo();
		End
		Else Print('?G??MAICAP You are not allowed to alter password?M?J')
	else if unique(.tmp,sixbit'PRIV',2) then 
		if prvbit(pvcprv) then
		Begin
			tmp _ 0;
			Print('Change any user?? ');
			if yesno() then tmp<35-pvcall,1> _ 1;
			Print('Change uname?? ');
			if yesno() then tmp<35-pvcunm,1> _ 1;
			Print('Change full name?? ');
			if yesno() then tmp<35-pvcfnm,1> _ 1;
			Print('Change PPN name?? ');
			if yesno() then tmp<35-pvcnam,1> _ 1;
			Print('Change file device?? ');
			if yesno() then tmp<35-pvcdev,1> _ 1;
			Print('Change filename?? ');
			if yesno() then tmp<35-pvcfln,1> _ 1;
			Print('Change file extension?? ');
			if yesno() then tmp<35-pvcext,1> _ 1;
			Print('Change password?? ');
			if yesno() then tmp<35-pvcpas,1> _ 1;
			Print('Change privword?? ');
			if yesno() then tmp<35-pvcprv,1> _ 1;
			Print('Change PPN?? ');
			if yesno() then tmp<35-pvcppn,1> _ 1;
			Print('Can send all?? ');
			if yesno() then tmp<35-pvsall,1> _ 1;
			Print('Can send to any group?? ');
			if yesno() then tmp<35-pvsagp,1> _ 1;
			Print('Can send to own groups?? ');
			if yesno() then tmp<35-pvsogp,1> _ 1;
			Print('Can change group information?? ');
			if yesno() then tmp<35-pvcgrp,1> _ 1;
			Print('Can delete all mail?? ');
			if yesno() then tmp<35-pvdall,1> _ 1;
			Print('Can examine groups?? ');
			if yesno() then tmp<35-pvgrp,1> _ 1;
			Print('Can examine password?? ');
			if yesno() then tmp<35-pvpass,1> _ 1;
			Print('Can examine privword?? ');
			if yesno() then tmp<35-pvpriv,1> _ 1;
			Print('Can examine PPN name?? ');
			if yesno() then tmp<35-pvunam,1> _ 1;
			Print('Can examine PPN?? ');
			if yesno() then tmp<35-pvppn,1> _ 1;
			Print('Can examine file?? ');
			if yesno() then tmp<35-pvfile,1> _ 1;
			if .acct[accnm1] EQL sixbit'ALL' then
				if .acct2[accnm1] EQL sixbit'ALL' then
					if .tmp<35-pvcprv,1> NEQ 1 then
					Begin
						Print('?G%You have disallowed ALL to change it''s privword?M?J');
						Print('   Are you sure?? ');
						If NOT yesno() then tmp<35-pvcprv,1> _ 1;
					End;
			acct2[accprv] _ .tmp;
		end
		else Print('?G??MAIUAP You may not alter the privword?M?J')
	else if unique(.tmp,sixbit'PPN',2) then
		If prvbit(pvcppn) then
		Begin
			tmp _ inppn(.ac3,FALSE);
			IF (.tmp EQL 0) THEN
			BEGIN
				Print('PPN: ');
				tmp _ inppn(0,FALSE);
			END;
			If (.tmp NEQ 0) then Acct2[accppn]_.tmp;
			If (.tmp EQL 0) Then Print('?M?J?G%PPN is unchanged?M?J');
		End
		Else Print('???GMAICCP Can''t change PPN?M?J')
	else if unique(.tmp,sixbit'LIST',1) then
		Begin
			Print('?M?JUname: ');
			Sixout(.acct2[accnm1],6);
			Sixout(.acct2[accnm2],-1);
			Crlf;
			Print('PPN Name: ');
			If prvbit(pvunam) then
				Begin
				Sixout(.acct2[accus1],-1);
				Sixout(.acct2[accus2],-1);
				End
				Else Print('<Unavailable>');
			Crlf;
			Print('Full name: ');
			Outs(address(acct2[accfnm]));
			Crlf;
			Print('PPN: ');
			If prvbit(pvppn) then Outppn(.acct2[accppn])
				else Print('<Unavailable>');
			Crlf;
			Print('Mailfile: ');
			If prvbit(pvfile) then
			Begin
				Sixout(.acct2[accmfd],-1);
				Outc(":");
				Sixout(.acct2[accmlf],-1);
				Outc(".");
				Sixout(.acct2[accmfe],-1);
			End
			Else	Print('<Unavailable>');
			Crlf;
			Print('Password: ');
			If prvbit(pvpass) then
				Sixout(.acct2[accpas],-1)
			else Print('<Unavailable>');
			Crlf;
			Print('Groups: ');
			If prvbit(pvgrp) then
			Begin
				tmp _ FALSE;
				If (.acct2[accgp1] NEQ 0) then
				Begin
					Sixout(.acct2[accgp1],-1);
					Print('  ');
					tmp _ true;
				End;
				If (.acct2[accgp2] NEQ 0) then
				Begin
					Sixout(.acct2[accgp2],-1);
					Print('  ');
					tmp _ true;
				End;
				If (.acct2[accgp3] NEQ 0) then
				Begin
					Sixout(.acct2[accgp3],-1);
					Print('  ');
					tmp _ true;
				End;
				If (.acct2[accgp4] NEQ 0) then
				Begin
					Sixout(.acct2[accgp4],-1);
					Print('  ');
					tmp _ true;
				End;
				If (.acct2[accgp5] NEQ 0) then
				Begin
					Sixout(.acct2[accgp5],-1);
					Print('  ');
					tmp _ true;
				End;
				If NOT(.tmp) then Print('<none>');
			End
			Else	Print('<Unavailable>');
			Crlf;
			Print('Privileges: ');
			If prvbit(pvpriv) then
			Begin
				If .acct2[accprv] EQL 0 then Print('<None>')
					else Crlf;
				If prvbt2(pvcall) then Print('?IChange any user?M?J');
				If prvbt2(pvcunm) then Print('?IChange uname?M?J');
				If prvbt2(pvcfnm) then Print('?IChange full name?M?J');
				If prvbt2(pvcnam) then print('?IChange PPN name?M?J');
				If prvbt2(pvcdev) then print('?IChange file device?M?J');
				If prvbt2(pvcfln) then print('?IChange filename?M?J');
				If prvbt2(pvcext) then print('?IChange file extension?M?J');
				If prvbt2(pvcgrp) then print('?IChange group information?M?J');
				If prvbt2(pvcpas) then print('?IChange password?M?J');
				If prvbt2(pvcppn) then print('?IChange PPN?M?J');
				If prvbt2(pvsall) then print('?ICan send to ALL?M?J');
				If prvbt2(pvsagp) then print('?ICan send to any group?M?J');
				If prvbt2(pvsogp) then print('?ICan send to own groups?M?J');
				If prvbt2(pvdall) then print('?ICan delete ALL mail?M?J');
				If prvbt2(pvpass) then print('?ICan examine password?M?J');
				If prvbt2(pvpriv) then print('?ICan examine privword?M?J');
				If prvbt2(pvppn) then print('?ICan examine PPN?M?J');
				If prvbt2(pvgrp) then print('?ICan examine groups?M?J');
				If prvbt2(pvfile) then print('?ICan examine file?M?J');
				If prvbt2(pvunam) then print('?ICan examine PPN name?M?J');
				Crlf;
			end
			else	Print('<Unavailable>');
			Crlf;
		End
	else Print('?G??MAIUAC Unknown ALTER command - Type HELP for help?M?J');
End;
End;
end
eludom