[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

256.0. "Flakey mail problem" by NY1MM::CANZONERI (Sal Canzoneri) Wed Jun 11 1986 17:41

    Has anyone noticed that sometimes VMSmail tells you that you have
    X new mail messages when you don't?  Anyone have a way to fix this
    or do (can) I hack VMSMAIL.DAT?
    
    							-Sal 
T.RTitleUserPersonal
Name
DateLines
256.1READ/NEW will fix itPLDVAX::ZARLENGAMichael Zarlenga - LMO2/E06Wed Jun 11 1986 18:155
    	To get rid of the 'phantom' MAIL msg you can type READ/NEW
    at the MAIL> prompt. I have no idea why the problem occurs,
    just how to remedy it.
    
    mike
256.2WA1KNX::BOWKERJoe Bowker, KB1GPWed Jun 11 1986 20:139
    One way that this happens is if your system manager has restored
    a copy of your system disk or a copy of the sysuaf.dat . 
        
    The new mail count is stored  in the sysuaf.dat file. Normally it
    agrees with the actual number of new messages, but once in while
    due to hardware failures, crashes, things that go bump in the night,
    etc. they will get out of sync. As .1 states, it is easy to fix.
    
    Joe
256.3As stated in reply .1DELNI::CANTORDave CantorWed Jun 11 1986 21:4512
      Re .2
      
      Beginning with VMS V4, the mail count is kept in VMSMAIL.DAT,
      not SYSUAF.DAT.  The supported way to synchronize the count
      with the actual number of new messages is to deplete the number
      of new messages to zero by issuing READ/NEW until there are
      no new messages.
      
      Hacking of SYS$EXAMPLES:MAILUAF.COM can be done to implement
      a command which changes the new mail count for an individual.
      
      Dave C.
256.4Oh, I remember THAT one!SUBSYS::LAWLERThu Jun 12 1986 11:159
    You can also send yourself 2 messages (Creating an 2 new message
    entry, make 2 copies of your mail.mai file, and 'read messages'
    until they go away, delete the first copy of mail.mai and 
    rename the second to mail.mai and 'read' again until you get
    the count down where you want it.  (Sal, I hope you didn't
    do that to your whole system.  :^)
    
    						al
    
256.5I like doing things the HARD way!JON::MORONEYThu Jun 12 1986 16:373
re .-1:  Yup, I created a command procedure that did that to set the count to
zero.  I was going to clean it up and submit it to the COMMAND_PROCEDURES
conference, but but there's no need to, now. 
256.6It is in the manualHITECH::BLOTCKYFri Jun 13 1986 18:595
"If the number of new (unread) mail messages displayed on your screen is 
inconsistent with the actual number of new messages, enter the READ/NEW 
command when there is no new mail"

VAX/VMS Mail Utility Reference Manual, page 15
256.7Do It Yourself, Mail messages !!!ROYCE::ATTWOOLA legend in his own lunch timeMon Jun 23 1986 14:4340
    
    
    c
    c	This program should be executed from a PRIV a account.
    c	
    c   Basically this  allows you to change any persons newmail
    c	account record to a specified value.
    c	 Can be quite funny if you give your friend 999999 new
    c	mail messages !!!
    c
    c    share and enjoy...
    c
    c		Justyn k (jka)
    
    
    
    
    	program mailfix
	common/rec/user,flag,new,spare
	character*31 user,find
	integer*2 flag,new,spare(100)
	character*1 buff(200)
	equivalence (user,buff)
	open(unit=1,file='sys$system:vmsmail.dat',organization='indexed',
	1    form='formatted',access='keyed',
	1    status='old')

1	write(5,*)'User name'
	read(5,15,end=999)find
15	format(a)
	read(1,22,err=1,key=find)l,(buff(j),j=1,l)
22	FORMAT(Q,200A)
	write(5,*)new,'value for new messages'
	read(5,*,end=1)i
	new=i
	rewrite(1,23)(buff(j),j=1,l)
23	FORMAT(200A)
	goto 1
999	stop
	end
256.8missing only a littleMANANA::COLGATEWim ColgateMon Jun 23 1986 20:055
    When you extract this program, you have got to put the comments
    in column 1. Also, you need to open the file SHARED.
    
    Wim
    
256.9.feep feep feep...ROYCE::ATTWOOLA legend in his own lunch timeTue Jun 24 1986 08:286
    
     Opps.. sorry about that, i added the comments in last.
    
    
    Jka
    
256.10GAOV08::MAGICConor Moran - GalwayTue Jun 24 1986 08:516

	Just out of interest, is it possible to tell if somebody you
	are mailing to has set a forwarding address ?

<CFM>
256.11preventing forwardingLOGIC::PUDERKarl PuderWed Jun 25 1986 19:552
    re .10  I don't know how to detect it, but the forwarding can be
    prevented by sending to node::_user
256.12Sometimes...JON::MORONEYMadmanThu Jun 26 1986 00:148
>	Just out of interest, is it possible to tell if somebody you
>	are mailing to has set a forwarding address ?

Well...if the node he SET FORWARD to is unreachable, you'll get a message
that the node is unreachable, and it prints the name of the remote node so
you can tell it from the case where the first node is unreachable.

-Mike
256.13A clumsy way using NCPSUBSYS::LAWLERN9910QThu Jun 26 1986 11:177
    You could do an
    NCP>Tell Remote_node SHO KNOWN LINKS
    
      Before and during the message, and see if an extra link 
    appears.  That would tell you if it were being forwarded
    to a remote system anyway.
    
256.14What about NMAIL?GALLO::RASPUZZIMichael RaspuzziThu Jun 26 1986 16:444
    Re .13: But would that work if the person has his forwarding address
    in NMAIL style (NM%node::user)?
    
    Mike
256.15Another MAILFIXCANYON::HESTERMANScott HestermanFri Jul 11 1986 18:24433
>    Re .13: But would that work if the person has his forwarding address
>    in NMAIL style (NM%node::user)?
    
Nope.  But then you could always check the NMAIL queues...

Here's my version of MAILFIX which was written at the time of our
upgrade to 4.0  (funny how we both chose the same name...)

Note:  You will need to modify line 255 to reflect your node name
or add code to find out what it is.

This program works fine for most cases.  There are certain variations
of wildcards not allowed, and other cases that loop.  Sorry, no
documentation on those bugs!

SLH "All good programs have bugs!"

1	! MAILFIX.BAS
	!
	! Created: 03-MAY-1985
	! Author:  Scott L. Hesterman   PXO SWS
	!    I would like to acknowledge the help of Gary R. Phoenix
	!    without whose help this project would not have been possible.
	!
	!Revision History
	!
	! 01.4	 30-Oct-1985	SLH
	!	  Alert user if an account has a FORWARDing Address
	!	  Also check forwarding address for remote node name
	!
	! 01.3	 30-Oct-1985	SLH
	!	  Added a trap for non-existent user directory
	!	  Added a trap for ^C at 3010
	!	  Added version numbers
	!	  Now user-defined mail directories are allowed for.
	!
	! 01.2	 17-May-1985	SLH
	!	  Fixed some of yesterday's wild coding...
	!	* Added general HELP
	!
	! 01.1	 16-May-1985	SLH
	!	  Improved wildcard prompting with added HELP
	!	  Added error traps for non-existant user MAIL.MAI, eof for SYSUAF,
	!	  and invalid MAIL.MAI file format.
	!
	! 01.0	 09-May-1985	SLH
	!	  Added ^Z handling
	!
	!
	!-----------------------------------------------------------------------
	!
	!
	!ABSTRACT:
	!
	!  During the conversion from VMS 3.7 to 4.0 some users' mail files
	!  will end up with an incorrect New Message count.
	!  The mail file format for VMS 4.0 is different from 3.7
	!  When a user uses MAIL for the first time after the upgrade
	!  MAIL will convert the users personal MAIL.MAI file to the proper
	!  format.  If, however, a user receives mail BEFORE converting the
	!  file he will be forever plagued by 'ghost messages'.  That is to
	!  say, at every login and use of MAIL there will be at least one
	!  more message listed than is actually there.  Typically it will
	!  always say "One messge waiting" when there are none.
	!
	!Theory of Operation:
	!  You are prompted for the VMS USERNAME to be fixed.  The SYSUAF file
	!  is searched to find the user's login directory.  If the user exists
	!  then the VMSMAIL file is searched to find the current message count.
	!  The user's own MAIL.MAI file is then examined to count all messages
	!  in the NEWMAIL folder.
	!
	!  The VMSMAIL count will be displayed.  If this does not match the
	!  NEWMAIL count then you are asked whether or not to correct the count.
	!  If you respond "yes", then the VMSMAIL record is immediatly updated.
	!  When finished simply enter EXIT as the user name.
	!
20	ON ERROR GOTO 32000
	A% = CTRLC		!enable control C trapping

100	MAP (REKORD) 	BYTE	REKORD(2048)
	MAP (REKORD)	DOUBLE 	MAILTIME,			&
			BYTE	FOLDER_LENGTH,			&
			STRING 	FOLDER = 39%

170	MAP (VMSMAIL)	STRING  Mail_name = 31%,		&
			BYTE 	FILL(2),			&
			BYTE	MSG_COUNT,			&
			STRING	FILLER = 31%,			&
			BYTE	MAIL_DIR_LEN,			&
			BYTE	PERS_NAME_LEN,			&
			BYTE	FORWARD_LEN,			&
			STRING	NAME_MAIL_DIR = 128%,		&
			STRING  F = 256%


180	MAP (SYSUAF)	BYTE UAE(1600)
	MAP (SYSUAF)	BYTE FILL(4),				&
			STRING User_name = 32%,			&
			BYTE FILL(16),				&
			STRING ACCOUNT = 32%,			&
			BYTE   OWNER_NAME_LEN,			&
			STRING OWNER_NAME = 31%,		&
			BYTE   DEVICE_NAME_LEN,			&
			STRING DEVICE_NAME = 31%,		&
			BYTE   DIR_NAME_LEN,			&
			STRING DIR_NAME = 63%,			&
			BYTE   LGICMD_LEN,			&
			STRING LGICMD = 39%			 !? not sure ?

200 	OPEN "SYS$SYSTEM:SYSUAF.DAT" FOR INPUT AS FILE #1%	&
		,ORGANIZATION INDEXED				&
		,RECORDTYPE ANY					&
		,ACCESS READ					&
		,ALLOW MODIFY					&
		,MAP SYSUAF

210 	OPEN "SYS$SYSTEM:VMSMAIL.DAT" FOR INPUT AS FILE #2%	&
		,ORGANIZATION INDEXED VARIABLE			&
		,RECORDTYPE ANY					&
		,ACCESS MODIFY					&
		,ALLOW MODIFY					&
		,MAP VMSMAIL

240	declare string bell

250	bell = chr$(7)
	updt$ = "NO"
	declare string search_method
	search_method = "SINGLE"
	Confirm = 1
	nulcnt = 0			! number of null responses

255	Current_Node$="SWD005"		! Don't include ::

260	Print
	Print "MAILFIX V01.4   *** VMS 4.1   30-Oct-1985 ***"
300	Print
305	if search_method = "WILDCARD" then goto 320

306	INPUT "User name to find (or EXIT to exit) ",Username$
	Username$=Edit$(Username$,34%)				! Uppercase,
								! no spaces
	IF   Username$="EXIT"					&
	  or Username$="EXI"					&
	  or Username$="EX"					&
	 then goto 32100

307	IF   Username$="QUIT"					&
	  or Username$="QUI"					&
	  or Username$="QU"					&
	 then goto 32100

308	if   Username$="HELP"					&
	  or Username$="HEL"					&
	  or Username$="HE"					&
	  or Username$="H"					&
	 then goto 8000

310	if Username$>"" then goto 314

311	nulcnt = nulcnt + 1
312	if nulcnt < 3 then goto 306
313	Print "Type HELP for assistance."
	nulcnt = 0
	goto 300

314	if Mid$(Username$,Len(Username$),1)<>"*" then goto 350

315	search_method="WILDCARD"
	Username$=Left$(Username$,Len(Username$)-1)
	Usrnamsav$=Username$
316	If Username$="" then Username$="A"
317	Find #1%, KEY #0 GE Username$
320	GET #1%
	Username$ = edit$(User_name,34%)
325	if Usrnamsav$ = left$(Username$,len(Usrnamsav$)) then goto 500
330	search_method = "SINGLE"		! No Match Found
	goto 300

349	! No wild-card in progress

350	GET #1%, KEY #0 EQ Username$
400	if Username$=User_name then goto 500	! exact match found

	! No wild-card specified, No exact match found, but
	! Search string exactly matches a found name up to search strings length

410	if Username$ = left$(User_name,len(Username$)) then goto 420
415	Print "No more matches for '";Username$;"'"
	goto 300

420	Print " '";Username$;"' matches '";edit$(user_name,34%);"'"
	Print "* Is this the correct user?  <No> ";
	input g$
	g$ = left$(edit$(g$,34%),1)
	if g$ = "" then g$="N"

430	if g$ <> "Y"				&
	    then
		Usrnam$ = Left$( edit$(user_name,34%)+"AAAAAAAAAAA" , 12)
		Get #1%, key #0 GT Usrnam$
		goto 410


	! User says this is the one 

440	Username$ = edit$(user_name,34%)
	

	! We now have the right username in Username$

500	DEV$ = LEFT$(DEVICE_NAME,DEVICE_NAME_LEN)
	DIR$ = LEFT$(DIR_NAME,DIR_NAME_LEN-1)
	if search_method = "WILDCARD"				&
	  then
	    Print
	    Print "User '";Username$;"'"

510	GET #2% , KEY #0 EQ Username$		!get MSG_COUNT
	IF FORWARD_LEN = 0 then 580

520	Print "Mail is being forwarded to ";!
	Username$=Left$( NAME_MAIL_DIR, FORWARD_LEN)
	Print Username$			!
	DC = instr(1%,Username$,"::")	!check for remote node name
	If DC = 0 then 350		!

530	Node$=Left$(Username$,DC-1)	!
	Username$=Right$(Username$,DC+2)!
	If Node$=Current_Node$ then 350	!ok on current node

540	Print "    ";Node$;" is a remote node."
	goto 300

580	MAIL$ = MID$( NAME_MAIL_DIR, FORWARD_LEN+PERS_NAME_LEN+2, MAIL_DIR_LEN-1)
	IF MAIL$="" then MAIL$="]"

590	dir$=dir$+mail$


     CHECK_NEW_MAIL:
2000	!**********************************************************************
	!

2200	NEW_MAIL_CNT = 0
	OPEN DEV$+DIR$+"MAIL.MAI" FOR INPUT AS FILE #3%		&
		,ORGANIZATION INDEXED VARIABLE			&
		,RECORDTYPE ANY					&
		,ACCESS READ					&
		,ALLOW WRITE					&
		,MAP REKORD					&
		,RECORDSIZE 2048

2250	FIND #3%,  KEY #1  EQ "NEWMAIL"

2260	GET #3%
	IF LEFT$(FOLDER, 7%) <> "NEWMAIL" THEN GOTO 2260

2270	NEW_MAIL_CNT = NEW_MAIL_CNT + 1
	GOTO 2260

2990	CLOSE #3%

3000	!**********************************************************************
	!
	Print "   Master record indicates ";MSG_COUNT
	IF MSG_COUNT = NEW_MAIL_CNT then 5000

3010	Print "   Mail file actually has  ";NEW_MAIL_CNT
	INPUT "* Change it? <Yes> ", G$
	G$=left$(edit$(G$,34%),3)
	IF G$ = "Y" or G$="YES"	or G$=""			&
	 then
	   Msg_count = NEW_MAIL_CNT
	   UPDATE #2%
	   Print "   We have updated ";Username$
	   updt$ = "YES"
	 else
	   Print "   NOT changed."
3245	GOTO 6000

5000	Print "   This is correct."

6000	if search_method = "SINGLE" then goto 300
6005	if Confirm = 0 then goto 300
6010	Print "Next, Go, or Quit <Next> ";
6020	input g$
	g$=edit$(G$,34%)

6021	if     g$="N"		&
	    or g$="NE"		&
	    or g$="NEX"		&
	    or g$="NEXT"	&
	  then goto 300

6022	if     g$="G"		&
	    or g$="GO"		&
	  then
		Confirm = 0
		goto 300

6023	if     g$="H"		&
	    or g$="HE"		&
	    or g$="HEL"		&
	    or g$="HELP"	&
	  then goto 6200

6024	if     g$="Q"		&
	    or g$="QU"		&
	    or g$="QUI"		&
	    or g$="QUIT"	&
	  then 
		search_method = "SINGLE"
		goto 300

6025	if     g$="E"		&
	    or g$="EX"		&
	    or g$="EXI"		&
	    or g$="EXIT"	&
	  then goto 32100

6090	goto 300

6200	Print
	Print "Type the command of your choice.  Then press the RETURN key."
	Print
	Print "NEXT - Continue on with the next user name"
	Print "GO   - Continue on with no further prompting"
	Print "QUIT - Stop processing users"
	Print "         (Abbreviations are ok)"
	goto 6010


8000	Print "Sorry!  No help is currently available.  Try again in the"
	Print "next update of this program."
	goto 300


32000	!**********************************************************************
	!
	if ERL = 306 and ERR = 11 then		! ^Z from kybd
	  resume 32100				! lets quit
	end if					!
	!
	IF ERL = 350 and ERR = 155 then
	  Print
	  Print bell;"No such user.  (";Username$;")"
	  Print
	  resume 300
	end if
	!
	if ERL = 320 and ERR = 11 then		!end of SYSUAF file
	   Print "No more users."		!
	   search_method = "SINGLE"		!
	   resume 300				!
	end if
	!
	if ERL = 420 and ERR = 11 then		!^Z from kybd during user match
	   resume 300				!so quit searching
	end if
	!
	IF ERL = 510 and ERR = 155 then		!not in VMSMAIL.DAT
	   Print Username$;" not found in";	!big problem!!!
	   Print " VMSMAIL.DAT !!";bell		!
	   resume 300				!
	end if					!
	!
	If ERL = 2200 and ERR = 1 then		! No Directory for user
	   Print "User directory does not exist"! assume NEW_MAIL_CNT = 0
	   Print bell;				! and continue
	   resume 3000				!
	end if
	!
	If ERL = 2200 and ERR = 2 then		! Illegal file name
	   Print "Illegal file name: ";		! 
	   Print DEV$+DIR$;bell			! 
	   resume 300				!
	end if
	!
	IF ERL = 2200 and ERR = 5 then		!no MAIL.MAI file
	   Print "No mail file found for user ";!assume NEW_MAIL_CNT = 0
	   Print Username$;"...";bell		!and continue
	   resume 3000				!
	end if
	!
	if ERL = 2200 and ERR = 168 then	!wrong file format
	   Print bell;"Old style mail file..."	!
	   resume 3000				!
	end if
	!
	if ERL = 2250 and ERR = 155 THEN	!no outstanding mail
	    resume 2990				!
	 end if					!
	!
	if ERL = 2260 and ERR = 11 then		!end of file
	    resume 2990				!
	end if					!
	!
	IF ERL = 3010 and ERR = 11 then		! ^Z from kybd
	  Print	"No change made to ";Username$	! can't quit just yet...
	  Print 
	  resume 300
	END IF
	!
	IF ERL = 3010 and ERR = 28 then		! ^C from kybd
	  Print	"No change made to ";Username$	! can't quit just yet...
	  Print 
	  resume 300
	END IF
	!
	IF ERL = 6020 and ERR = 11 then		! ^Z from kybd during wildcard
	    search_method = "SINGLE"		!   switch back to manual and
	    resume 300				!   continue
	END IF
	!
	if ERL =  1 and ERR = 28 then		! ^C
	    Print "^C interrupt."		! (crude method)
	    confirm = 1				!
	    resume 300
	!
	!
	!
32010	Print bell;"ERROR "; ERR; " - "; ERT$(ERR); " on line "; ERL
	RESUME 32100
	!
32100	if updt$ = "YES"			&
	then Print "VMSMAIL.DAT updated."		&
	else Print "No changes made to VMSMAIL.DAT."

32200	Print
	END

256.16Other silliness with this bugTUNDRA::HARRIMANMon Jul 28 1986 14:4423
    re: .0 et al
    
    	Gee I had those types of problems but for different reasons.
    
    Notable (other) ways that it happens are:
    
      - using more than one system disk in a cluster (does it every
    time)
    
      - more than one (UAF) account accessing the same mail directory.
    
    	This is insidious and infuriating. I once had two accounts which
    pointed to the same directory (don't ask why). MAIL to one account
    name would, of course, show up in the mail file, but if the other
    account read the mail first then it would corrupt VMSMAIL.DAT,
    naturally since VMSMAIL.DAT assumes you are one user, one mail file.
    
    	Solution in both cases is to make sure there is a one-to-one
    relationship between SYSUAF records and VMSMAIL.DAT records and
    to make very sure you have SYS$COMMON in your cluster.
    
    /pjh