Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    138

    Question Unanswered: C-Programming under SCO-Development

    Is here anyone who can help me out in C-programming under
    SCO-Unix Development

    First, I need a funktion or command to read the systemdate and the systemuname.



    Thanks
    Greetings from germany
    Peter F.

  2. #2
    Join Date
    Sep 2003
    Posts
    71
    something like this?

    hp91>cat showdate.c
    #include <stdio.h>
    main()
    {
    char ucmd[100];
    sprintf(ucmd,"echo system date is `date`");
    system(ucmd);
    sprintf(ucmd,"echo hostname is `hostname`");
    system(ucmd);
    }
    ================================
    hp91>cc showdate.c
    hp91>a.out
    system date is Wed Mar 3 08:55:36 EST 2004
    hostname is hp91

  3. #3
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    138
    Hi skd,
    thanx for your interest to my problem.

    It is not the real way that I want to do. I need the result in a variable and not on screen.

    I give you some more details.

    I wrote a shell script witch bild a number for a second login passwort.
    Now a want do do it by a C-programm because other users can not read the opperations in the binary executable file. To build this number I used
    the last two digits from uname(allways 1-99 at the end), day, month, year and a fix digit in this vain.

    FIX="1234"
    UNAME=`uname -n | awk '{
    len=length($1)
    dummy=substr($1, len-1, 2)
    print dummy
    }'`
    ALGO=$FIX
    ALGO=`expr $ALGO * $UNAME `
    ALGO=`expr $ALGO * $DAY `
    ALGO=`expr $ALGO * $MONTH `
    ALGO=`expr $ALGO * $YEAR `
    # after this, I take the last digit from $ALGO and divide $ALGO for
    # n times whith the value "3" as an integer without floating point
    LAST=`echo $ALGO | awk '{
    lang=length($1)
    dummy=substr($1, lang, 1)
    print dummy
    }'`

    while [ "$LAST" != "0" ]
    do
    LAST=`expr $LAST - 1 `
    ALGO=`expr $ALGO \/ 3 `
    done

    echo $ALGO > myfile
    Greetings from germany
    Peter F.

  4. #4
    Join Date
    Feb 2004
    Posts
    17
    Why don't you just make the file unreadable for others?
    # chmod go-r file
    Writing a program in C because it is not immediately readable by humans is (imo, sorry) poor security. There are tools to reverese the compilation process after all.

  5. #5
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    138
    Hi S_Scheible ,
    thanx for answer. The problem is as followed.
    If our support team have a shell on systemconsole they can change to root, because they do any administrative workings. The second login passwort only works by using the online shell over modem or ISDN.
    Greetings from germany
    Peter F.

  6. #6
    Join Date
    Feb 2004
    Posts
    17
    Originally posted by fla5do
    If our support team have a shell on systemconsole they can change to root, because they do any administrative workings. The second login passwort only works by using the online shell over modem or ISDN.
    I see. Hmm I think you should read
    # man 2 time
    and the manpages it references. One of the later should be able to format the time as you see fit.

    # man 2 uname
    should solve the other, uname-related problem.

    I was going to suppose sudo, but I guess your support team has to fulfill various administrative tasks, not just a few, so this is not an option.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •