[comp.sys.ibm.pc] Help !!

barton@killer.DALLAS.TX.US (Barton Fisk) (01/27/89)

I need a user to be able to run a shell script to disable a serial
line for dial out.

This is due to the fact that the comm prog we are using DOES NOT 
support ungetty on SCO 2.2.

I CAN NOT use cu or uucp for transfer of files to this particular
location.

So, in order for me to be able to run this comm prog (Blast), I 
must first disable the line or I get an error (comm port in use).

Then after transfer is made, I need this script to re-enable the
line.

In normal everyday operation this line is both dial-in and dial-out.

If anyone can help me do this without having to become root, I 
would greatly appreciate the help.

Also, when I tried to invoke ungetty from the script before 
calling in my comm prog, the getty refused to be suspended and
upon trying to dial-out afterwards the message "DIALOUT is on
tty1A" was produced.

Thanks again for any suggestions.


Barton A. Fisk
Barton A. Fisk & Co., Inc.
P.O. Box 1781
Lake Charles, La.   70602         (318) 439-5984
--------------------------------------------------------
+++++++ Can anything good come out of Louisiana? ++++++
--------------------------------------------------------

jbayer@ispi.UUCP (Jonathan Bayer) (01/28/89)

In article <6932@killer.DALLAS.TX.US> barton@killer.DALLAS.TX.US (Barton Fisk) writes:
>I need a user to be able to run a shell script to disable a serial
>line for dial out.
>
	[deleted]
>
>So, in order for me to be able to run this comm prog (Blast), I 
>must first disable the line or I get an error (comm port in use).
>
>Then after transfer is made, I need this script to re-enable the
>line.
>


One thing you might try is to write a couple of small programs which
would simple call enable and disable with the appropriate uids set. 
That way you can have a setuid program doing the work without letting
anybody become root.

Jb

-- 
Jonathan Bayer			      Beware: The light at the end of the
Intelligent Software Products, Inc.	      tunnel may be an oncoming dragon
19 Virginia Ave.				...uunet!ispi!jbayer
Rockville Centre, NY 11570  (516) 766-2867    jbayer@ispi

root@conexch.UUCP (Larry Dighera) (02/01/89)

In article <6932@killer.DALLAS.TX.US> barton@killer.DALLAS.TX.US (Barton Fisk) writes:
>I need a user to be able to run a shell script to disable a serial
>line for dial out.
>
>If anyone can help me do this without having to become root, I 
>would greatly appreciate the help.
>
>Also, when I tried to invoke ungetty from the script before 
>calling in my comm prog, the getty refused to be suspended and
>upon trying to dial-out afterwards the message "DIALOUT is on
>tty1A" was produced.
>
>Thanks again for any suggestions.
>
>
>Barton A. Fisk

There are many approaches that can be used to accomplish this.  Most 
of them will require that you trust the user of the communications
program to some extent.

Given that the files in question have the following default permissions:

-rwsr-xr-x   1 lp       bin        19500 May 16  1988 /bin/disable
-rwsr-xr-x   1 lp       bin        14932 May 16  1988 /bin/enable
crw-r-----   1 uucp     uucp       5,128 Jan 31 11:54 /dev/tty1A
-rw-rw-r--   1 root     root         304 Jan 31 10:59 /etc/ttys

you could put the communications program user in a unique group during the
communications session with the newgrp command, and have the group
on the above files set to that group.  This is probably the simplest.

The program below will allow users to run execute-only shell scripts
as though they were root.  So, if you put the disable command (and any
other necessary commands) in a small shell script and call that script
as an argument to exonly, it should work.  You can use group permissions
to limit the accessibility of exonly to trusted users.  

On the other hand, depending on security considerations on the system,
you may find this approach unacceptable. 

Larry Dighera

===========================  exonly.c begins  =============================

/*
 *      exonly.c
 *      Author: Stephen Kochan
 *      exonly opens the (execute-only) shell program,
 *      given as the first argument, onto 
 *      standard input and executes the shell.
 *
 *      exonly must be SUID to the owner 
 *      of the shell program or root.
 *
 *
 *      This source is based on the listing in the June '87 issue of
 *      UNIX/WORLD Magizine, pp 95.  Entered by Larry Dighera 
 *      The Consultants' Exchange BBS (714) 842-6348/5851.
 */

#include <stdio.h>

main (argc, argv)
int argc;
char *argv[];
{
/*
 * Check number of arguments.  If < 2, no file
 * was specified, so generate error message and exit.
 */
        if (argc < 2) {
                fprintf (stderr, "exonly: needs file\n");
                exit (1);
        }
/*
 * Check accessibility of shell program by REAL uid.
 */
        if (access (argv[1], 1) == -1)   {
                fprintf (stderr,
                "exonly: cannot execute %s\n",argv[1]);
                exit (2);
        }
/*
 * Close standard inpput and re-open with first argument.
 * Generate error message if file can't be opened.
 */
        close (0);
        if (open (argv[1], 0) < 0) {
                fprintf (stderr,
                "exonly: cannot open %s\n", argv[1]);
                exit (3);
        }
/*
 * Turn off setuid/setgid capability now that file is open.
 */
/*
 * (You may want to comment this out depending on the necessity
 * for your user to have an effective id of root to run 
 * the necessary commands.)
 */
        setgid (getgid ());
        setuid (getuid ());
/*
 * Set up argument list to /bin/sh.
 */
        argv[0] = "/bin/sh";
        argv[1] = "-s"; /* reads shell script from stdin */
/*
 * exec /bin/sh with -s option.  Pass any arguments 
 * along in the argv list.  Print error message 
 * if we can't exec /bin/sh.
 */
        execv ("/bin/sh", argv);
        fprintf (stderr,
                "exonly: cannot exec /bin/sh\n");
        exit (4);
}
===========================  exonly.c ends  =============================

-- 
USPS: The Consultants' Exchange, PO Box 12100, Santa Ana, CA  92712
TELE: (714) 842-6348: BBS (N81); (714) 842-5851: Xenix guest account (E71)
UUCP: conexch Any ACU 2400 17148425851 ogin:-""-ogin:-""-ogin: nuucp
UUCP: ...!uunet!turnkey!conexch!root || ...!trwrb!ucla-an!conexch!root

cmm1@CUNIXA.CC.COLUMBIA.EDU (Christopher M Mauritz) (05/23/89)

Does anyone out there have a small program that will cause a pc to reboot?
I am writing a batch file that creates a ramdisk, fills it with stuff, runs
a few programs and then ends.  I would like to have the batch file get rid
of the RAMdisk and then reboot at the end.  Could someone help me out?
If such an animal exists, could someone uuencode it and send it to me?  I'm
getting a bit desperate, as I've been trying to get this stupid thing to work
for about a week.  I don't read this newsgroup very often so please send any
replies directly to me.  THANKS!

Chris Mauritz
cmm1@cunixa.cc.columbia.edu
No points for second best!!

fisher@sc2a.unige.ch (Markus Fischer) (06/05/89)

In article <8905231642.AA09814@cunixa.cc.columbia.edu>, cmm1@CUNIXA.CC.COLUMBIA.EDU (Christopher M Mauritz) writes:
> Does anyone out there have a small program that will cause a pc to reboot?

I do !

This question certainly has much better answers, but here is one that works for
my IBM AT 2.  The idea comes from the implementation of  the <Alt-Ctrl-Del> key
in some  obscure keyboard  driver from  DOS 2.11...  i.e. jumping  to the right
address.  I have heard say there is an interrupt, you might want to  check that
also...

Cut these two files as `*.deb' or the like, then feed them to DEBUG, as:
prompt> DEBUG < BOOT.DEB
They simply  say `a'ssemble (follows the code... an empty line to stop), `n'ame
the file as (string), `rcx' - new value  for CX,  containing the  length of the
file, `n' being the length, `w'rite the file, and `q'uit !

--- COLDBOOT.DEB ----------------------------------------------
a
         JMP F000:FFF0                          

n COLDBOOT.COM
rcx
5
w
q
--- WARMBOOT.DEB ----------------------------------------------
a
           MOV AX,0040                            
           MOV ES,AX                              
           ES:                                    
           MOV WORD PTR [0072],1234               
           JMP F000:FFF0                          

n WARMBOOT.COM
rcx
11
w
q
---------------------------------------------------------------

Voila`!   The only  difference between  the two  is that the `warm'boot doesn't
count the memory again.

Hope this is useful !

Markus Fischer                -|--|--|--|--|--|--I   Department of Anthropology
                        -|--|--|--|--|--|--|-(#)-I   University of Geneva
      -|--|--|--|--|--|--|--|--|-(#)-|-(#)(#)(_)-I   CH-1227  Carouge (GE)
   -&-(_)-|--|--|-(#)-&--|-(#)(#)(_)(#)-&-(_)(#)-I   Switzerland
            -|--|--|--|--|-(#)(_)-|-(_)(_)(_)(#)-I
black (#) to kill ! --|--|-(#)(_)(_)(_)(#)(#)(_)(_)  fisher@sc2a.unige.ch
=+==+==+==+==+==+==+==+==+==+==+==+==+==+==+=(#)=+   fisher@cgeuge52.bitnet

brent@sactoh0.UUCP (Brent K. Barrett) (11/16/89)

 HELP!  I'm in some trouble here, and all the debugging I'm capable
of hasn't helped (yet).  I'm working on a project called TPR (what
it does isn't important) in Turbo C 2.0.  
 
 The problem:  TLINK reports "Undefined symbol 'FPE1st' in module
EMUINIT" (and the same for 'FPElast').  I will include my MAKEFILE
and a copy of the MAP file.
 
 I've done many programs using the emu.lib and floating point data
types, so it's not something new to me.  This, however, has never
happened before.  The only floating point is in one function in the
module entitled "main.c."  The float type is part of a structure,
and is also referenced when printed by printf().  I will include 
the function as well at the end of this message.
 
 Please respond by mail only as I'm not always reading these
newsgroups.  Thank you very much.

 
MAKEFILE:
.c.obj:
  tcc -mc -Id:\src\novu -c $<
 
tpr.exe: main.obj misc.obj screen.obj file.obj help.obj
    tlink /c d:\src\novu\c0c main misc screen file help, tpr,,\
      d:\src\novu\emu d:\src\novu\cc
 
main.obj: tpr.h
misc.obj: tpr.h
screen.obj: tpr.h
file.obj: tpr.h
help.obj: tpr.h

MAP FILE:
 Start  Stop   Length Name               Class
 
 00000H 03D12H 03D13H _TEXT              CODE
 03D20H 06316H 025F7H EMU_PROG           CODE
 06320H 06736H 00417H E87_PROG           CODE
 06740H 07059H 0091AH _DATA              DATA
 0705AH 0705DH 00004H _EMUSEG            DATA
 0705EH 0705FH 00002H _CRTSEG            DATA
 07060H 07061H 00002H _CVTSEG            DATA
 07062H 07067H 00006H _SCNSEG            DATA
 07068H 08057H 00FF0H _BSS               BSS
 08058H 08058H 00000H _BSSEND            STACK
 08060H 08145H 000E6H _STACK             STACK
 
Undefined symbol 'FPE1st' in module EMUINIT
Undefined symbol 'FPElast' in module EMUINIT
Program entry point at 0000:0000
 
/*
 *  do_calc()
 */
void do_calc(int m_min, int m_max, int c_min, int c_max)
{
    struct {
        int min;
        int max;
        float sens;
    } ctrl[9] = { {  40,  65, 0.48F },  /* Johnson Controls values
*/
                  {  60,  85, 0.48F },
                  {  50, 100, 0.24F },
                  {  20, 120, 0.12F },
                  {   0, 100, 0.12F },
                  {  50, 150, 0.12F },
                  { -40, 160, 0.06F },
                  {  40, 240, 0.06F },
                  { 200, 400, 0.06F }
                };
    char which;
    float ratio;
    int m_temp;
    int c_temp;
 
    gotoxy(1, 25);
    for (which=0; which<9; which++)
        printf("Min=%d, Max=%d, Sens=%f\n", ctrl[which].min,
ctrl[which].max,
          ctrl[which].sens);
 
    getch();
}
 
 (Note:  this is only a test function at this time, hence the lack
of use of the arguments :-).

-- 
  ////////      Novucivitas: The Future of Citadel       //////// 
 ///    US 916 725 0674 3/12/2400 bps GEMAIL: B.K.BARRETT    /// 
////////          ..ames!pacbell!sactoh0!brent         //////// 

evas@cs.eur.nl (Eelco van Asperen) (11/16/89)

brent@sactoh0.UUCP (Brent K. Barrett) writes:
> The problem:  TLINK reports "Undefined symbol 'FPE1st' in module
>EMUINIT" (and the same for 'FPElast').  I will include my MAKEFILE
>and a copy of the MAP file.

Try including the math-library (MATHC.LIB for Compact-model).
That should solve the problem. 
[Algorithm: TDUMP MATHC.LIB | grep FPE1 ]


-- 
Eelco van Asperen
Uucp: evas@cs.eur.nl ||  Earn/Bitnet: asperen@hroeur5
"Stick a fork in their ass and turn them over, they're done",
					Lou Reed, Last Great American Whale

john@wsl.UUCP (John Allen on wsl) (11/18/89)

In article <2101@sactoh0.UUCP>, brent@sactoh0.UUCP (Brent K. Barrett) writes:
> 
>  The problem:  TLINK reports "Undefined symbol 'FPE1st' in module

You are missing the mathc.lib on the tlink command line.

-- 
People that don't know want to know from the people that do know and if the 
poeple that do know don't tell the people that don't know then the people
that don't know still won't know.
				   "Don't quote me on any issue whatsoever."

brent@sactoh0.UUCP (Brent K. Barrett) (11/19/89)

 
 I want to thank the one fellow who did respond.  Although my
problem wasn't really related to the solution he suggested, it was
very nice of him to at least try.
 
 I solved the problem myself after some work and a big SMACK on the
head when I realized how stupid I was.  I had forgotten to include
to math library for the model I was using!  Ugh.  
 
 Thank you for your time.

-- 
  ////////      Novucivitas: The Future of Citadel       //////// 
 ///    US 916 725 0674 3/12/2400 bps GEMAIL: B.K.BARRETT    /// 
////////          ..ames!pacbell!sactoh0!brent         //////// 

65820@neabbs.UUCP (RONALD VAN EIJCK) (03/28/90)

We need HELP:

1: We want to use an MS-DOS parallel port as some kind of userport.
   Therefore we have to be able to access this port directly and to change
   the input/output of the datalines/statuslines.
   We want to know whether this is possible and how to access the port.

2: Borland's PUTIMAGE is not fast enough for our application. does anybody
   know how to access the video ram of a VGA card? As far as we know the
   first plane starts at A000:0000 where do the other 3 planes start?

3: We have problem's setting the mousecursor on a VGA graphics screen.
   Does anyone know where we can find some code doing this in turbo pascal

   We are using Turbo Pascal 5.5 on a 286 2MB AT

Thanks in advance,
                     Ronald van Eijck
                     R&R Software
                     The Netherlands