Article 13077 of alt.sources:
Newsgroups: alt.sources
Path: nntpd.lkg.dec.com!sousa.amt.tay1.dec.com!pa.dec.com!decwrl!spool.mu.edu!usenet.eel.ufl.edu!tank.news.pipex.net!pipex!news.mathworks.com!newsfeed.internetmci.com!howland.reston.ans.net!ix.netcom.com!netcom.com!henderso
From: henderso@netcom.com (Mark C. Henderson)
Subject: change sun hostid 1.6.1 -- part 2/5
Message-ID: <hendersoDJyIx3.2CM@netcom.com>
Organization: Netcom
Date: Thu, 21 Dec 1995 22:10:15 GMT
Lines: 1337
Sender: henderso@netcom12.netcom.com


#!/bin/sh
# This is part 02 of a multipart archive
# ============= hid-1.6.1/spoof-solaris1/kern_hostid.c ==============
if test ! -d 'hid-1.6.1'; then
    echo 'x - creating directory hid-1.6.1'
    mkdir 'hid-1.6.1'
fi
if test ! -d 'hid-1.6.1/spoof-solaris1'; then
    echo 'x - creating directory hid-1.6.1/spoof-solaris1'
    mkdir 'hid-1.6.1/spoof-solaris1'
fi
if test -f 'hid-1.6.1/spoof-solaris1/kern_hostid.c' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris1/kern_hostid.c (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris1/kern_hostid.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris1/kern_hostid.c' &&
/*
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose. You use
this program at your own risk. The author disclaims responsibility for
any damages that might result from the use of this program, even
if they result from negligence on the part of the author.
X
Also, please don't use this program to steal software. The intended
use is for emergency situations where an application has to be moved from
one computer to another (e.g. in the event of a hardware malfunction)
and licence keys cannot be obtained quickly from the vendor. Many
vendors will not supply licence keys outside of business hours.
*/
X
#include <sys/param.h>
#include <sys/syscall.h>
#include <sys/systm.h>
#include <sys/user.h>
#include <sys/kernel.h>
#include <sun/vddrv.h>
#include "hid_flags.h"
X
#define NHOSTID 10
X
static unsigned hostid[NHOSTID]={0};
static char xhostname[NHOSTID][MAXHOSTNAMELEN];
static int hid_flags[NHOSTID];
X
int sethostid();
int gethostname();
X
static struct sysent sethostid_sysent = { 5, sethostid } ;
X
static struct vdlsys vd = {
X  VDMAGIC_SYS, /* magic number */
X  "sethostid", /* name */
X  0, /* syscall number (filled in automagically) */
X  &sethostid_sysent /* description of syscall */
};
X
Gethostid()
{
X    unsigned machineid;
X    u_short gid;
X    int i;
X
X    gethostid();
X    machineid = u.u_r.r_val1;
X
X    gid = u.u_gid;
X    if (gid >= 900 && gid < 900+NHOSTID) {
X        if (hid_flags[gid-900] & HID_HOSTID) {
X            u.u_r.r_val1 = hostid[gid-900] ? hostid[gid-900] : machineid;
X            return;
X        }
X    }
X
X    i = 0;
X    while (gid=u.u_groups[i++]) {
X        if (gid >= 900 && gid < 900+NHOSTID) {
X            if (hid_flags[gid-900] & HID_HOSTID) {
X                u.u_r.r_val1 = hostid[gid-900] ? hostid[gid-900] : machineid;
X                return;
X            }
X        }
X    }
X    u.u_r.r_val1 = machineid;
X    return;
}
X
Gethostname(uap)
X    register struct a {
X        char *namebuf;
X        int namebuflen;
X    } *uap;
{
X    char *hp;
X    int hl,i;
X    u_short gid;
X
X    gid = u.u_gid;
X    hp = hostname;
X    hl = hostnamelen;
X    if (gid >= 900 && gid < 900+NHOSTID) {
X        if (hid_flags[gid-900] & HID_HOSTNAME) {
X            hp = xhostname[gid-900]; hl = strlen(xhostname[gid-900]);
X        }
X    }
X
X    i = 0;
X    while (gid=u.u_groups[i++]) {
X        if (gid >= 900 && gid < 900+NHOSTID) {
X            if (hid_flags[gid-900] & HID_HOSTNAME) {
X                hp = xhostname[gid-900]; hl = strlen(xhostname[gid-900]);
X            }
X        }
X    }
X    hl++;
X    if (hl > uap->namebuflen) 
X        hl = uap->namebuflen;
X    if (copyout(hp, uap->namebuf, hl) < 0) {
X         u.u_r.r_val1 = (-1); u.u_error = EFAULT; return;
X    }
X    u.u_r.r_val1 = 0;
X    u.u_error = 0;
X    return;
}
X
sethostid(uap)
X    register struct a {
X        int n;
X        int flags;
X        char *hostname;
X        int hostnamelen;
X        unsigned hostid;
X    } *uap;
{
X    if (!suser()) {
X        u.u_r.r_val1 = (-1); u.u_error = EACCES; return;
X    }
X
X    if ((uap->n >= NHOSTID )||(uap->n < 0)) {  
X        u.u_r.r_val1 = (-1); u.u_error = EINVAL; return;
X    }
X
X    hid_flags[uap->n] = uap->flags;
X    if (uap->flags & HID_HOSTID) {
X        hostid[uap->n] = uap->hostid;
X    }
X    if (uap->flags & HID_HOSTNAME) {
X        if (uap->hostnamelen >= MAXHOSTNAMELEN || uap->hostnamelen < 0) {
X            u.u_r.r_val1 = (-1); u.u_error = EINVAL; return;
X        }
X        if ((copyin(uap->hostname,xhostname[uap->n],uap->hostnamelen) < 0)) {
X            u.u_r.r_val1 = (-1); u.u_error = EFAULT; return;
X        }
X        xhostname[uap->n][uap->hostnamelen] = '\0'; /* null terminate */
X    }
X    u.u_r.r_val1 = 0;
X    u.u_error = 0;
X    return;
}
X
X
sethostidinit(function_code, vdp, vdi, vds)
unsigned int function_code;
struct vddrv *vdp;
addr_t vdi;
struct vdstat *vds;
{
X  int i;
X  switch (function_code) {
X  case VDLOAD:
X    vdp->vdd_vdtab = (struct vdlinkage *)&vd;
X    sysent[SYS_gethostid].sy_narg = 2;
X    sysent[SYS_gethostid].sy_call = Gethostid;
X    sysent[SYS_gethostname].sy_narg = 2;
X    sysent[SYS_gethostname].sy_call = Gethostname;
X    for (i=0; i<NHOSTID; i++) {
X        xhostname[i][0] = '\0';
X        hostid[i] = 0x0;
X        hid_flags[i] = 0;
X    }
X    return 0;
X  case VDUNLOAD:
X    sysent[SYS_gethostname].sy_narg = 2;
X    sysent[SYS_gethostname].sy_call = gethostname;
X    sysent[SYS_gethostid].sy_narg = 2;
X    sysent[SYS_gethostid].sy_call = gethostid;
X    return 0;
X  case VDSTAT:
X    return 0;
X  default:
X    return EIO;
X  }
}
X
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris1/kern_hostid.c ||
echo 'restore of hid-1.6.1/spoof-solaris1/kern_hostid.c failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris1/kern_hostid.c'`"
test 4596 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris1/kern_hostid.c: original size 4596, current size' "$Wc_c"
fi
# ============= hid-1.6.1/spoof-solaris1/makefile ==============
if test -f 'hid-1.6.1/spoof-solaris1/makefile' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris1/makefile (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris1/makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris1/makefile' &&
CFLAGS = -DKERNEL
ASFLAGS = -P
X
load: kern_hostid.o
X	chmod +x sethostid.exec
X	/usr/etc/modload kern_hostid.o -v -entry _sethostidinit -exec sethostid.exec
X
sethostid: sethostid.o sethostid.h
X	cc -o sethostid -I. sethostid.c
X
clean:
X	rm -f core *.o sethostid kern_hostid sethostid.h
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris1/makefile ||
echo 'restore of hid-1.6.1/spoof-solaris1/makefile failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris1/makefile'`"
test 282 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris1/makefile: original size 282, current size' "$Wc_c"
fi
# ============= hid-1.6.1/spoof-solaris1/sethostid.c ==============
if test -f 'hid-1.6.1/spoof-solaris1/sethostid.c' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris1/sethostid.c (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris1/sethostid.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris1/sethostid.c' &&
/*
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose. You use
this program at your own risk. The author disclaims responsibility for
any damages that might result from the use of this program, even
if they result from negligence on the part of the author.
X
Also, please don't use this program to steal software. The intended
use is for emergency situations where an application has to be moved from
one computer to another (e.g. in the event of a hardware malfunction)
and licence keys cannot be obtained quickly from the vendor. Many
vendors will not supply licence keys outside of business hours.
*/
X
#include <stdio.h>
#include <sys/syscall.h>
#include <errno.h>
#include "sethostid.h"
#include "hid_flags.h"
X
main(argc, argv)
int argc;
char *argv[];
{
X  unsigned hostid;
X  int n;
X
X  if (argc<3) {
X    fprintf(stderr, "%s <n> <hostid> [hostname]\n", argv[0]);
X    exit(1);
X  }
X  n=atoi(argv[1]);
X  sscanf(argv[2], "%x", &hostid);
X  fprintf(stderr, "will set hostid for group %d set to %08x\n", 900+n,hostid);
X  if (argc == 4) {
X    fprintf(stderr, "will set for hostname group %d set to %s\n", 900+n,argv[3]);
X    if (syscall(SYS_sethostid, n, HID_HOSTID|HID_HOSTNAME, 
X        argv[3], strlen(argv[3]), hostid)==-1) {
X      perror(argv[0]);
X      exit(1);
X    }
X  }
X  else {
X    if (syscall(SYS_sethostid, n, HID_HOSTID, 
X        NULL, 0, hostid)==-1) {
X      perror(argv[0]);
X      exit(1);
X    }
X  }
}  
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris1/sethostid.c ||
echo 'restore of hid-1.6.1/spoof-solaris1/sethostid.c failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris1/sethostid.c'`"
test 1539 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris1/sethostid.c: original size 1539, current size' "$Wc_c"
fi
# ============= hid-1.6.1/spoof-solaris1/sethostid.exec ==============
if test -f 'hid-1.6.1/spoof-solaris1/sethostid.exec' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris1/sethostid.exec (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris1/sethostid.exec (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris1/sethostid.exec' &&
#!/bin/csh -f
echo "#define SYS_sethostid $3" > sethostid.h
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris1/sethostid.exec ||
echo 'restore of hid-1.6.1/spoof-solaris1/sethostid.exec failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris1/sethostid.exec'`"
test 60 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris1/sethostid.exec: original size 60, current size' "$Wc_c"
fi
# ============= hid-1.6.1/spoof-solaris2/README ==============
if test ! -d 'hid-1.6.1/spoof-solaris2'; then
    echo 'x - creating directory hid-1.6.1/spoof-solaris2'
    mkdir 'hid-1.6.1/spoof-solaris2'
fi
if test -f 'hid-1.6.1/spoof-solaris2/README' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris2/README (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris2/README (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris2/README' &&
Instructions:
X
You need to do everything below as root.
X
1. Add an entry to /etc/name_to_sysnum for the sethostid system call.
For instance, I use the following line.
sethostid       177
X
Do not put any leading whitespace on the line in /etc/name_to_sysnum.
X
The important thing is to pick an unused syscall number. There
is also a limit on the number you can pick, which is determined
by the size of the sysent table. To find out what the limit is
you can use adb (only for Solaris 2.3 - just be reasonable if you
are using 2.4). For solaris 2.5 you can look at the NSYSCALL define
in /usr/include/sys/systm.h
X
adb -k /dev/ksyms /dev/mem
sysentsize/D
^D        #  i.e. control-D
X
You should be able to pick any unused syscall number between 1 and the
number output by adb above minus 1. Alternatively just use an unused
number which is less than the largest number which occurs in
/etc/name_to_sysnum
X
Now reboot your system.
X
2. Look at the makefile and check that the location of the C compiler is
right for your system. You do NOT want to get /usr/ucb/cc. gcc should
be OK.
X
If you are running Solaris 2.3 or 2.4 you MUST uncomment the define
-DPRE_SOLARIS_2_5 in the makefile. The results of not doing so are
unpredictable.
X
3. Type
make load
X
This should load the sethostid call. 
X
4. Type 
make sid
X
This makes the program that allows you to modify the hostid for
a particular group.
X
e.g. Now you can modify the hostid and hostname for group 900 to be 
23000000 and joe.test.com respectively by typing
./sid 0 23000000 joe.test.com
X
You'll probably want to make sure that joe.test.com is in whatever
name->ip address resolution scheme you use. (DNS,NIS, files)
X
X
6. If you like you can install sid and sethostid by typing
make install
X
If you do this, when you reboot, the sethostid module will be
automatically loaded when sethostid is called (i.e. when you run sid).
X
If you also need to "spoof" IP addresses, proceed as follows. Otherwise
you can stop here.
X
7. To make the system think it has additional IP addresses (say the one
X   corresponding to joe.test.com) you can use ifconfig
X
X   /usr/sbin/ifconfig lo0:1 joe.test.com up       # joe.test.com
X   /usr/sbin/ifconfig lo0:2 192.1.1.1 up          # also be 192.1.1.1
X
X   (you can also use le0:1 and le1:1 here as appropriate in which case
X    you may not need to play with the routes below)
X
8. add a route to joe.test.com
X    /usr/sbin/route add joe.test.com ratatosk 0
X    (where ratatosk is the real name of the local host)
X
9. compile and link run (in ../run) if you haven't already done this.
X
10. If you are running YP/NIS you need to do the following
X    run 0 /usr/sbin/rpcbind
X    run 0 /usr/lib/netsvc/yp/ypbind -broadcast
there will be some console messages from rpcbind, but you will have
two copies of rpcbind.
X
You may also need to start up rpcbind as above for other applications.
X
11. If you want another host, say squirrel to be able to reach joe.test.com
X    login to squirrel and execute
X    route add joe.test.com ratatosk 1
X    (where ratatosk is the real name of the local host)
X
X    then from squirrel when you "telnet joe.test.com" you'll get to 
X    ratatosk.
X
X
You can unload the system call as follows.
X
Type
/usr/sbin/modinfo
X
X You'll get output which includes a line which looks something like
76 fc42d000   621 177   1  sethostid (kern_hostid v1.0)
X
To remove the module type
/usr/sbin/modunload -i 76
Replace 76 by the first number in the line output by modinfo.
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris2/README ||
echo 'restore of hid-1.6.1/spoof-solaris2/README failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris2/README'`"
test 3460 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris2/README: original size 3460, current size' "$Wc_c"
fi
# ============= hid-1.6.1/spoof-solaris2/hid_flags.h ==============
if test -f 'hid-1.6.1/spoof-solaris2/hid_flags.h' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris2/hid_flags.h (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris2/hid_flags.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris2/hid_flags.h' &&
#define HID_HOSTID 0x01
#define HID_HOSTNAME 0x02
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris2/hid_flags.h ||
echo 'restore of hid-1.6.1/spoof-solaris2/hid_flags.h failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris2/hid_flags.h'`"
test 50 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris2/hid_flags.h: original size 50, current size' "$Wc_c"
fi
# ============= hid-1.6.1/spoof-solaris2/makefile ==============
if test -f 'hid-1.6.1/spoof-solaris2/makefile' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris2/makefile (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris2/makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris2/makefile' &&
CFLAGS = -D_KERNEL  # -DPRE_SOLARIS_2_5
ASFLAGS = -P
CC = /opt/SUNWspro/bin/cc
X
load: sethostid
X	/usr/sbin/modload ./sethostid
X
sethostid: sethostid.o
X	/usr/ccs/bin/ld -r -o sethostid sethostid.o
X
sid: sid.c
X	grep sethostid /etc/name_to_sysnum | sed 's/^/#define SYS_/' >sethostid.h
X	$(CC) -o sid -I. sid.c
X
install: sethostid sid
X	/usr/sbin/install -f /kernel/sys -m 0755 -u root -g sys ./sethostid
X	/usr/sbin/install -f /usr/sbin -m 0755 -u root -g sys ./sid
X
clean:
X	rm -f core *.o sid sethostid sethostid.h
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris2/makefile ||
echo 'restore of hid-1.6.1/spoof-solaris2/makefile failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris2/makefile'`"
test 511 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris2/makefile: original size 511, current size' "$Wc_c"
fi
# ============= hid-1.6.1/spoof-solaris2/sethostid.c ==============
if test -f 'hid-1.6.1/spoof-solaris2/sethostid.c' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris2/sethostid.c (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris2/sethostid.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris2/sethostid.c' &&
/*
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose. You use
this program at your own risk. The author disclaims responsibility for
any damages that might result from the use of this program, even
if they result from negligence on the part of the author.
X
Also, please don't use this program to steal software. The intended
use is for emergency situations where an application has to be moved from
one computer to another (e.g. in the event of a hardware malfunction)
and licence keys cannot be obtained quickly from the vendor. Many
vendors will not supply licence keys outside of business hours.
X
before you install this modify /etc/name_to_sysnum to bind sethostid to 
an _unused_ system call number
X
As far as I can determine the details of how to load system calls in
Solaris 2.3 are undocumented. I've done this by poking around in the
header files in sys and the man pages, and extrapolating from what 
I know about how loadable device drivers work and how the procedure 
works in Solaris 1.1
X
Mark Henderson <markh@wimsey.bc.ca>
1 Oct 1994
*/
X
#include <sys/param.h>
#include <sys/syscall.h>
#include <sys/systm.h>
#include <sys/user.h>
#include <sys/modctl.h>
#include <sys/cred.h>
#include <sys/utsname.h>
#include <sys/systeminfo.h>
#include <netdb.h>
#include "hid_flags.h"
X
#define NHOSTID 10
X
static char serials[NHOSTID][16];
char xyzzy_rbuf[SYS_NMLN];
char xhostname[NHOSTID][SYS_NMLN];
int hid_flags[NHOSTID];
X
int sethostid();
X
struct sysent sethostid_sysent = {5,0,sethostid,0};
X
extern struct mod_ops mod_syscallops;
X
static struct modlsys modlsys = {
&mod_syscallops,
"spoof v1.1", 
&sethostid_sysent,
};
X
#ifdef PRE_SOLARIS_2_5
extern systeminfo();
extern uname();
#else
extern longlong_t systeminfo();
extern longlong_t uname();
#endif
X
static struct modlinkage modlinkage = {
X    MODREV_1, /* magic number */
X    &modlsys, 
X    0
};
X
#ifdef PRE_SOLARIS_2_5
struct as3 {struct utsname *up;};
int new_uname(struct as3 *uap, rval_t *foo)
{
X    int ret,i,bsize;
X    gid_t gid;
X    cred_t *creds = CRED();
X    uname(uap,foo);
X    ret = foo->r_val1;
X    gid = creds->cr_gid;
X    bsize = SYS_NMLN;
X    if ((gid >= 900 && gid < 900+NHOSTID) && 
X            (hid_flags[gid-900] & HID_HOSTNAME)) {
X        if (xhostname[gid - 900][0]) {
X            for (i=0;i < bsize - 1;i++)
X                xyzzy_rbuf[i]  = xhostname[gid-900][i];
X            xyzzy_rbuf[bsize - 1] = 0;
X            ret = strlen(xyzzy_rbuf) + 1;
X            if (copyout(xyzzy_rbuf,uap->up->nodename,ret) < 0)
X                return EFAULT;
X        }
X    }
X    for (gid = 900; gid < 900+NHOSTID; gid++) {
X        if (groupmember(gid, creds)) {
X            if ((hid_flags[gid-900]&HID_HOSTNAME)&&xhostname[gid-900][0]) {
X                for (i=0;i< bsize - 1;i++)
X                    xyzzy_rbuf[i]  = xhostname[gid-900][i];
X                xyzzy_rbuf[bsize - 1] = 0;
X                ret = strlen(xyzzy_rbuf) + 1;
X                if (copyout(xyzzy_rbuf,uap->up->nodename,ret) < 0)
X                    return EFAULT;
X                break;
X            }
X        }
X    }
X    foo->r_val1 = ret;
X    return 0;
}
#else
longlong_t new_uname(struct utsname *name)
{
X    longlong_t ret;
X	int i,bsize;
X    gid_t gid;
X    cred_t *creds = CRED();
X
X    ret = uname(name);
X    gid = creds->cr_gid;
X    bsize = SYS_NMLN;
X    if ((gid >= 900 && gid < 900+NHOSTID) && 
X            (hid_flags[gid-900] & HID_HOSTNAME)) {
X        if (xhostname[gid - 900][0]) {
X            for (i=0;i < bsize - 1;i++)
X                xyzzy_rbuf[i]  = xhostname[gid-900][i];
X            xyzzy_rbuf[bsize - 1] = 0;
X            ret = strlen(xyzzy_rbuf) + 1;
X            if (copyout(xyzzy_rbuf,name->nodename,ret) < 0)
X                return EFAULT;
X        }
X    }
X    for (gid = 900; gid < 900+NHOSTID; gid++) {
X        if (groupmember(gid, creds)) {
X            if ((hid_flags[gid-900]&HID_HOSTNAME)&&xhostname[gid-900][0]) {
X                for (i=0;i< bsize - 1;i++)
X                    xyzzy_rbuf[i]  = xhostname[gid-900][i];
X                xyzzy_rbuf[bsize - 1] = 0;
X                ret = strlen(xyzzy_rbuf) + 1;
X                if (copyout(xyzzy_rbuf,name->nodename,ret) < 0)
X                    return EFAULT;
X                break;
X            }
X        }
X    }
X	return ret << 32;
}
#endif
X
#ifdef PRE_SOLARIS_2_5
struct as2 {int command; char *buf; long count;};
int new_systeminfo(struct as2 *uap, rval_t *foo)
{
X    int ret,i,bsize;
X    gid_t gid;
X    cred_t *creds = CRED();
X    systeminfo(uap,foo);
X    ret = foo->r_val1;
X    if (uap->command == SI_HW_SERIAL) {
X        gid = creds->cr_gid;
X        bsize = (uap->count > 16) ? 16 : uap->count; /* min(16,count)*/
X        if ((gid >= 900 && gid < 900+NHOSTID) && 
X                (hid_flags[gid-900] & HID_HOSTID)) {
X            if (serials[gid - 900][0]) {
X                for (i=0;i < bsize - 1;i++)
X                    xyzzy_rbuf[i]  = serials[gid-900][i];
X                xyzzy_rbuf[bsize - 1] = 0;
X                ret = strlen(xyzzy_rbuf) + 1;
X                if (copyout(xyzzy_rbuf,uap->buf,ret) < 0)
X                    return EFAULT;
X            }
X        }
X        for (gid = 900; gid < 900+NHOSTID; gid++) {
X            if (groupmember(gid, creds)) {
X                if ((hid_flags[gid-900]&HID_HOSTID)&&serials[gid - 900][0]) {
X                    for (i=0;i< bsize - 1;i++)
X                        xyzzy_rbuf[i]  = serials[gid-900][i];
X                    xyzzy_rbuf[bsize - 1] = 0;
X                    ret = strlen(xyzzy_rbuf) + 1;
X                    if (copyout(xyzzy_rbuf,uap->buf,ret) < 0)
X                        return EFAULT;
X                    break;
X                }
X            }
X        }
X    }
X    if (uap->command == SI_HOSTNAME) {
X        gid = creds->cr_gid;
X        bsize = (uap->count > SYS_NMLN) ? SYS_NMLN: uap->count;
X        if ((gid >= 900 && gid < 900+NHOSTID) && 
X                (hid_flags[gid-900] & HID_HOSTNAME)) {
X            if (xhostname[gid - 900][0]) {
X                for (i=0;i < bsize - 1;i++)
X                    xyzzy_rbuf[i]  = xhostname[gid-900][i];
X                xyzzy_rbuf[bsize - 1] = 0;
X                ret = strlen(xyzzy_rbuf) + 1;
X                if (copyout(xyzzy_rbuf,uap->buf,ret) < 0)
X                    return EFAULT;
X            }
X        }
X        for (gid = 900; gid < 900+NHOSTID; gid++) {
X            if (groupmember(gid, creds)) {
X                if ((hid_flags[gid-900]&HID_HOSTNAME)&&xhostname[gid-900][0]) {
X                    for (i=0;i< bsize - 1;i++)
X                        xyzzy_rbuf[i]  = xhostname[gid-900][i];
X                    xyzzy_rbuf[bsize - 1] = 0;
X                    ret = strlen(xyzzy_rbuf) + 1;
X                    if (copyout(xyzzy_rbuf,uap->buf,ret) < 0)
X                        return EFAULT;
X                    break;
X                }
X            }
X        }
X    }
X    foo->r_val1 = ret;
X    return 0;
}
#else 
longlong_t new_systeminfo(int command, char *buf, long count) 
{
X	longlong_t ret;
X    gid_t gid;
X	int bsize,i;
X    cred_t *creds = CRED();
X	int modified = 0;
X	ret = systeminfo(command, buf, count);
X    if (command == SI_HW_SERIAL) {
X        gid = creds->cr_gid;
X        bsize = (count > 16) ? 16 : count; /* min(16,count)*/
X        if ((gid >= 900 && gid < 900+NHOSTID) && 
X                (hid_flags[gid-900] & HID_HOSTID)) {
X            if (serials[gid - 900][0]) {
X                for (i=0;i < bsize - 1;i++)
X                    xyzzy_rbuf[i]  = serials[gid-900][i];
X                xyzzy_rbuf[bsize - 1] = 0;
X                ret = strlen(xyzzy_rbuf) + 1;
X				modified = 1;
X                if (copyout(xyzzy_rbuf,buf,ret) < 0)
X                    return EFAULT;
X            }
X        }
X        for (gid = 900; gid < 900+NHOSTID; gid++) {
X            if (groupmember(gid, creds)) {
X                if ((hid_flags[gid-900]&HID_HOSTID)&&serials[gid - 900][0]) {
X                    for (i=0;i< bsize - 1;i++)
X                        xyzzy_rbuf[i]  = serials[gid-900][i];
X                    xyzzy_rbuf[bsize - 1] = 0;
X                    ret = strlen(xyzzy_rbuf) + 1;
X					modified = 1;
X                    if (copyout(xyzzy_rbuf,buf,ret) < 0)
X                        return EFAULT;
X                    break;
X                }
X            }
X        }
X    }
X    if (command == SI_HOSTNAME) {
X        gid = creds->cr_gid;
X        bsize = (count > SYS_NMLN) ? SYS_NMLN: count;
X        if ((gid >= 900 && gid < 900+NHOSTID) && 
X                (hid_flags[gid-900] & HID_HOSTNAME)) {
X            if (xhostname[gid - 900][0]) {
X                for (i=0;i < bsize - 1;i++)
X                    xyzzy_rbuf[i]  = xhostname[gid-900][i];
X                xyzzy_rbuf[bsize - 1] = 0;
X                ret = strlen(xyzzy_rbuf) + 1;
X				modified = 1;
X                if (copyout(xyzzy_rbuf,buf,ret) < 0)
X                    return EFAULT;
X            }
X        }
X        for (gid = 900; gid < 900+NHOSTID; gid++) {
X            if (groupmember(gid, creds)) {
X                if ((hid_flags[gid-900]&HID_HOSTNAME)&&xhostname[gid-900][0]) {
X                    for (i=0;i< bsize - 1;i++)
X                        xyzzy_rbuf[i]  = xhostname[gid-900][i];
X                    xyzzy_rbuf[bsize - 1] = 0;
X                    ret = strlen(xyzzy_rbuf) + 1;
X					modified = 1;
X                    if (copyout(xyzzy_rbuf,buf,ret) < 0)
X                        return EFAULT;
X                    break;
X                }
X            }
X        }
X    }
X	if (modified) 
X		return (ret << 32);
X	else
X		return ret;
}
#endif
X
struct as {int n; int flags; char *hostname; int hostnamelen;
X    unsigned int hostid;};
X
sethostid(struct as *uap, rval_t *foo)
{
X    cred_t *creds = CRED();
X    if (!suser(creds)) {
X        return EACCES;
X    }
X
X    if ((uap->n >= NHOSTID )||(uap->n < 0)) {  
X        return EINVAL;
X    }
X    hid_flags[uap->n] = uap->flags; 
X    if (hid_flags[uap->n] & HID_HOSTID) 
X        numtos( (unsigned long)uap->hostid, &serials[uap->n][0]);
X    if (hid_flags[uap->n] & HID_HOSTNAME) {
X        if (uap->hostnamelen >= SYS_NMLN || uap->hostnamelen < 0) 
X            return EINVAL;
X        if ((copyin(uap->hostname,xhostname[uap->n],uap->hostnamelen) < 0)) 
X            return EFAULT; 
X        xhostname[uap->n][uap->hostnamelen] = '\0'; /* null terminate */
X    }
X    foo->r_val1 = 0;
X    return 0;
}
X
_init(void)
{
X    int i,status;
X    status = mod_install(&modlinkage);
X    if (!status) {
X        sysent[SYS_systeminfo].sy_narg = 3;
X        sysent[SYS_uname].sy_narg = 1;
#ifdef PRE_SOLARIS_2_5
X        sysent[SYS_systeminfo].sy_call = new_systeminfo;
X        sysent[SYS_uname].sy_call = new_uname;
#else
X		sysent[SYS_systeminfo].sy_callc = new_systeminfo;
X        sysent[SYS_uname].sy_callc = new_uname;
#endif
X        for (i=0; i < NHOSTID; i++)  {
X            serials[i][0] = 0;
X            xhostname[i][0] =  0;
X        }
X    }
X    return status;
}
_fini(void)
{
X    int status;
X    status = mod_remove(&modlinkage);
X    if (!status) {
X        sysent[SYS_systeminfo].sy_narg = 3;
X        sysent[SYS_uname].sy_narg = 1;
#ifdef PRE_SOLARIS_2_5
X        sysent[SYS_systeminfo].sy_call = systeminfo;
X        sysent[SYS_uname].sy_call = uname;
#else
X        sysent[SYS_systeminfo].sy_callc = systeminfo;
X        sysent[SYS_uname].sy_callc = uname;
#endif
X    }
X    return status;
}
X
_info(struct modinfo *modinfop)
{
X    return (mod_info(&modlinkage, modinfop));
}
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris2/sethostid.c ||
echo 'restore of hid-1.6.1/spoof-solaris2/sethostid.c failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris2/sethostid.c'`"
test 11397 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris2/sethostid.c: original size 11397, current size' "$Wc_c"
fi
# ============= hid-1.6.1/spoof-solaris2/sid.c ==============
if test -f 'hid-1.6.1/spoof-solaris2/sid.c' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris2/sid.c (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris2/sid.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris2/sid.c' &&
/*
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose. You use
this program at your own risk. The author disclaims responsibility for
any damages that might result from the use of this program, even
if they result from negligence on the part of the author.
X
Also, please don't use this program to steal software. The intended
use is for emergency situations where an application has to be moved from
one computer to another (e.g. in the event of a hardware malfunction)
and licence keys cannot be obtained quickly from the vendor. Many
vendors will not supply licence keys outside of business hours.
*/
X
#include <stdio.h>
#include <sys/syscall.h>
#include <errno.h>
#include "sethostid.h"
#include "hid_flags.h"
X
main(argc, argv)
int argc;
char *argv[];
{
X  unsigned hostid;
X  int n;
X
X  if (argc<4) {
X    fprintf(stderr, "%s <n> <hostid> <hostname>\n", argv[0]);
X    exit(1);
X  }
X  n=atoi(argv[1]);
X  hostid=strtoul(argv[2], NULL, 16);
X  fprintf(stderr, "will set hostid for group %d set to %08x\n", 900+n,hostid);
X  fprintf(stderr, "will set for hostname group %d set to %s\n", 900+n,argv[3]);
X  if (syscall(SYS_sethostid, n, HID_HOSTID|HID_HOSTNAME, 
X        argv[3], strlen(argv[3]), hostid)==-1) {
X    perror(argv[0]);
X    exit(1);
X  }
}  
X
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris2/sid.c ||
echo 'restore of hid-1.6.1/spoof-solaris2/sid.c failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris2/sid.c'`"
test 1374 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris2/sid.c: original size 1374, current size' "$Wc_c"
fi
# ============= hid-1.6.1/spoof-solaris2/sethostid.c~ ==============
if test -f 'hid-1.6.1/spoof-solaris2/sethostid.c~' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/spoof-solaris2/sethostid.c~ (File already exists)'
else
echo 'x - extracting hid-1.6.1/spoof-solaris2/sethostid.c~ (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/spoof-solaris2/sethostid.c~' &&
/*
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose. You use
this program at your own risk. The author disclaims responsibility for
any damages that might result from the use of this program, even
if they result from negligence on the part of the author.
X
Also, please don't use this program to steal software. The intended
use is for emergency situations where an application has to be moved from
one computer to another (e.g. in the event of a hardware malfunction)
and licence keys cannot be obtained quickly from the vendor. Many
vendors will not supply licence keys outside of business hours.
X
before you install this modify /etc/name_to_sysnum to bind sethostid to 
an _unused_ system call number
X
As far as I can determine the details of how to load system calls in
Solaris 2.3 are undocumented. I've done this by poking around in the
header files in sys and the man pages, and extrapolating from what 
I know about how loadable device drivers work and how the procedure 
works in Solaris 1.1
X
Mark Henderson <markh@wimsey.bc.ca>
1 Oct 1994
*/
X
#include <sys/param.h>
#include <sys/syscall.h>
#include <sys/systm.h>
#include <sys/user.h>
#include <sys/modctl.h>
#include <sys/cred.h>
#include <sys/utsname.h>
#include <sys/systeminfo.h>
#include <netdb.h>
#include "hid_flags.h"
X
#define NHOSTID 10
X
static char serials[NHOSTID][16];
char xyzzy_rbuf[SYS_NMLN];
char xhostname[NHOSTID][SYS_NMLN];
int hid_flags[NHOSTID];
X
int sethostid();
X
struct sysent sethostid_sysent = {5,0,sethostid,0};
X
extern struct mod_ops mod_syscallops;
X
static struct modlsys modlsys = {
&mod_syscallops,
"spoof v1.0", 
&sethostid_sysent,
};
X
extern systeminfo();
extern uname();
X
static struct modlinkage modlinkage = {
X    MODREV_1, /* magic number */
X    &modlsys, 
X    0
};
X
struct as3 {struct utsname *up;};
int new_uname(struct as3 *uap, rval_t *foo)
{
X    int ret,i,bsize;
X    gid_t gid;
X    cred_t *creds = CRED();
X    uname(uap,foo);
X    ret = foo->r_val1;
X    gid = creds->cr_gid;
X    bsize = SYS_NMLN;
X    if ((gid >= 900 && gid < 900+NHOSTID) && 
X            (hid_flags[gid-900] & HID_HOSTNAME)) {
X        if (xhostname[gid - 900][0]) {
X            for (i=0;i < bsize - 1;i++)
X                xyzzy_rbuf[i]  = xhostname[gid-900][i];
X            xyzzy_rbuf[bsize - 1] = 0;
X            ret = strlen(xyzzy_rbuf) + 1;
X            if (copyout(xyzzy_rbuf,uap->up->nodename,ret) < 0)
X                return EFAULT;
X        }
X    }
X    for (gid = 900; gid < 900+NHOSTID; gid++) {
X        if (groupmember(gid, creds)) {
X            if ((hid_flags[gid-900]&HID_HOSTNAME)&&xhostname[gid-900][0]) {
X                for (i=0;i< bsize - 1;i++)
X                    xyzzy_rbuf[i]  = xhostname[gid-900][i];
X                xyzzy_rbuf[bsize - 1] = 0;
X                ret = strlen(xyzzy_rbuf) + 1;
X                if (copyout(xyzzy_rbuf,uap->up->nodename,ret) < 0)
X                    return EFAULT;
X                break;
X            }
X        }
X    }
X    foo->r_val1 = ret;
X    return 0;
}
X
struct as2 {int command; char *buf; long count;};
int new_systeminfo(struct as2 *uap, rval_t *foo)
{
X    int ret,i,bsize;
X    gid_t gid;
X    cred_t *creds = CRED();
X    systeminfo(uap,foo);
X    ret = foo->r_val1;
X    if (uap->command == SI_HW_SERIAL) {
X        gid = creds->cr_gid;
X        bsize = (uap->count > 16) ? 16 : uap->count; /* min(16,count)*/
X        if ((gid >= 900 && gid < 900+NHOSTID) && 
X                (hid_flags[gid-900] & HID_HOSTID)) {
X            if (serials[gid - 900][0]) {
X                for (i=0;i < bsize - 1;i++)
X                    xyzzy_rbuf[i]  = serials[gid-900][i];
X                xyzzy_rbuf[bsize - 1] = 0;
X                ret = strlen(xyzzy_rbuf) + 1;
X                if (copyout(xyzzy_rbuf,uap->buf,ret) < 0)
X                    return EFAULT;
X            }
X        }
X        for (gid = 900; gid < 900+NHOSTID; gid++) {
X            if (groupmember(gid, creds)) {
X                if ((hid_flags[gid-900]&HID_HOSTID)&&serials[gid - 900][0]) {
X                    for (i=0;i< bsize - 1;i++)
X                        xyzzy_rbuf[i]  = serials[gid-900][i];
X                    xyzzy_rbuf[bsize - 1] = 0;
X                    ret = strlen(xyzzy_rbuf) + 1;
X                    if (copyout(xyzzy_rbuf,uap->buf,ret) < 0)
X                        return EFAULT;
X                    break;
X                }
X            }
X        }
X    }
X    if (uap->command == SI_HOSTNAME) {
X        gid = creds->cr_gid;
X        bsize = (uap->count > SYS_NMLN) ? SYS_NMLN: uap->count;
X        if ((gid >= 900 && gid < 900+NHOSTID) && 
X                (hid_flags[gid-900] & HID_HOSTNAME)) {
X            if (xhostname[gid - 900][0]) {
X                for (i=0;i < bsize - 1;i++)
X                    xyzzy_rbuf[i]  = xhostname[gid-900][i];
X                xyzzy_rbuf[bsize - 1] = 0;
X                ret = strlen(xyzzy_rbuf) + 1;
X                if (copyout(xyzzy_rbuf,uap->buf,ret) < 0)
X                    return EFAULT;
X            }
X        }
X        for (gid = 900; gid < 900+NHOSTID; gid++) {
X            if (groupmember(gid, creds)) {
X                if ((hid_flags[gid-900]&HID_HOSTNAME)&&xhostname[gid-900][0]) {
X                    for (i=0;i< bsize - 1;i++)
X                        xyzzy_rbuf[i]  = xhostname[gid-900][i];
X                    xyzzy_rbuf[bsize - 1] = 0;
X                    ret = strlen(xyzzy_rbuf) + 1;
X                    if (copyout(xyzzy_rbuf,uap->buf,ret) < 0)
X                        return EFAULT;
X                    break;
X                }
X            }
X        }
X    }
X    foo->r_val1 = ret;
X    return 0;
}
X
struct as {int n; int flags; char *hostname; int hostnamelen;
X    unsigned int hostid;};
X
sethostid(struct as *uap, rval_t *foo)
{
X    cred_t *creds = CRED();
X    if (!suser(creds)) {
X        return EACCES;
X    }
X
X    if ((uap->n >= NHOSTID )||(uap->n < 0)) {  
X        return EINVAL;
X    }
X    hid_flags[uap->n] = uap->flags; 
X    if (hid_flags[uap->n] & HID_HOSTID) 
X        numtos( (unsigned long)uap->hostid, &serials[uap->n][0]);
X    if (hid_flags[uap->n] & HID_HOSTNAME) {
X        if (uap->hostnamelen >= SYS_NMLN || uap->hostnamelen < 0) 
X            return EINVAL;
X        if ((copyin(uap->hostname,xhostname[uap->n],uap->hostnamelen) < 0)) 
X            return EFAULT; 
X        xhostname[uap->n][uap->hostnamelen] = '\0'; /* null terminate */
X    }
X    foo->r_val1 = 0;
X    return 0;
}
X
_init(void)
{
X    int i,status;
X    status = mod_install(&modlinkage);
X    if (!status) {
X        sysent[SYS_systeminfo].sy_narg = 3;
X        sysent[SYS_systeminfo].sy_call = new_systeminfo;
X        sysent[SYS_uname].sy_narg = 1;
X        sysent[SYS_uname].sy_call = new_uname;
X        for (i=0; i < NHOSTID; i++)  {
X            serials[i][0] = 0;
X            xhostname[i][0] =  0;
X        }
X    }
X    return status;
}
_fini(void)
{
X    int status;
X    status = mod_remove(&modlinkage);
X    if (!status) {
X        sysent[SYS_systeminfo].sy_narg = 3;
X        sysent[SYS_systeminfo].sy_call = systeminfo;
X        sysent[SYS_uname].sy_narg = 1;
X        sysent[SYS_uname].sy_call = uname;
X    }
X    return status;
}
X
_info(struct modinfo *modinfop)
{
X    return (mod_info(&modlinkage, modinfop));
}
SHAR_EOF
chmod 0700 hid-1.6.1/spoof-solaris2/sethostid.c~ ||
echo 'restore of hid-1.6.1/spoof-solaris2/sethostid.c~ failed'
Wc_c="`wc -c < 'hid-1.6.1/spoof-solaris2/sethostid.c~'`"
test 7239 -eq "$Wc_c" ||
	echo 'hid-1.6.1/spoof-solaris2/sethostid.c~: original size 7239, current size' "$Wc_c"
fi
# ============= hid-1.6.1/00README.FIRST ==============
if test -f 'hid-1.6.1/00README.FIRST' -a X"$1" != X"-c"; then
	echo 'x - skipping hid-1.6.1/00README.FIRST (File already exists)'
else
echo 'x - extracting hid-1.6.1/00README.FIRST (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'hid-1.6.1/00README.FIRST' &&
Version: 1.6.1
Dec 1995
X
Ever been up at 3am on Monday morning trying to move an essential 
application from one piece of hardware to another and been unable to 
do it because you'll need a new licence key from your vendor and they 
don't give them out at weird hours? Well, here's a solution that 
works in many cases. Basically it allows you to modify the value 
returned by gethostid/sysinfo for the hostid on Solaris 1.x and 2.3/4
X
This package can also be used to reprogram a new NVRAM chip if your
NVRAM fails for some reason. In particular the NVRAM on the Sun 3/80 
and all sun4c machines (Sparc 1,1+,2,IPC,ELC,IPX,etc.) will fail after
a relatively short period of time. See nvram.info if you need to do this.
X
See the file INSTRUCTIONS for more details than provided here.
X
Note that there are examples which show how to load system calls via
modload into running kernels on Sun OS 4.1.x and 5.3/5.4/5.5. 
X
This kit contains scripts/programs to do this using four different
approaches. These are (pretty much in the order of severity and danger):
1. Use shared libraries to modify the value returned by gethostid/sysinfo
X   for a particular group of dynamically linked executables. Does not
X   work for statically linked executables.
X   newhostid, sidump.c (Solaris 1.x and 2.3), sysinfo.c (Solaris 2.3 & later)
X   newhostid was contributed by Jean-Louis Faraut <jlf@sauma.essi.fr>
X
2. Modify the in-core image of the kernel so that all processes on a running 
X   Solaris system will see a different hostid via gethostid/sysinfo.
X   hid.c, hid_solaris2.c (Solaris 1.1 and 2.3-2.5), 
X   sethostid-simple-4.1, sethostid-simple-5.x
X
3. Build a new kernel on which certain processes running on a Solaris 
X   system will see a different hostid which can be set by a new
X      system call (well, really just the old sethostid system call) 
X   hostid-by-egid (Solaris 1.1 only).
X   Contributed by someone who wishes to remain anonymous
X
X   hostid-by-egid-modload - dynamically loadable version of the
X   above. Basically, it lets you load the new sethostid system call
X   without completely rebuilding your kernel. Based on the above
X   contribution.  
X
X   hostid-by-egid-solaris2 - version of this for Solaris 2.3-2.5
X
X   As an aside these might be useful to someone because they show
X   how to dynamically load new system calls into the kernel on 
X   Solaris 1.1 and 2.3-2.5.
X
4. Reprogram your NVRAM so that you really have changed your hostid. 
X   SPARC only.
X   nvram.c (Solaris 1.x only), nvram.info (instructions for
X                                           reprogramming from the monitor)
X   nvram-sol2.c (solaris 2.4, 2.5)
X   The other approaches just fake your OS into reporting a
X   different hostid via the standard system calls.  This approach is
X   much more dangerous, but you may have to resort to it if your
X   licence manager actually goes and fetches the IDPROM value (perhaps
X   through the OPENPROM interface, see getobphostid.c for a way of
X   doing this). In particular 1 and 2 can be undone very easily (reboot). 
X   Approach 3 can be undone by rebooting with one's old kernel.  The NVRAM 
X   modifier if it is abused or malfunctions can actually render your 
X   machine unbootable, even from CDROM. Read the comments in nvram.c and 
X   nvram.info before trying this. I don't generally recommend it.
X
------------------------------------
I'll try and maintain a copy of the latest version of this package
X  on ftp.netcom.com:/pub/he/henderso
X     ftp.wimsey.com:/pub/crypto/netcom-mirror
X
Please don't use these programs to steal software or to violate your
licence agreements with software vendors. The intended use is for
emergency situations where an application has to be moved from one
computer to another (e.g. in the event of a hardware malfunction) and
licence keys cannot be obtained quickly from the vendor or when your
NVRAM gets wiped out by some unfortunate accident.
X
USE AT YOUR OWN RISK.
X
nvram.c and nvram-sol2.c are particularly dangerous.  Read the comments
and proceed with extreme caution. If this program malfunctions or is
misused you can get your NVRAM into a state where you will no longer be
able to boot Sun OS.  Unless you absolutely need to modify your NVRAM,
I recommend going with the approach in hid/hid_solaris2.  Reprogramming
your NVRAM can be useful when it gets wiped out for some reason. BE
SURE TO WRITE DOWN YOUR NVRAM INFO BEFORE YOU MODIFY IT.
X
Finally, if you want to communicate with me regarding this package,
and have privacy concerns, you can send me PGP encrypted messages. 
X
I'd also really appreciate receiving any bug reports, encrypted or 
not.
X
Here's my public key:
X
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: 2.7.1
X
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
2gA=
=WDJg
-----END PGP PUBLIC KEY BLOCK-----
Mark Henderson <markh@wimsey.bc.ca>
X
-- NEW FEATURES --
nvram-sol2.c   new to 1.3.5
spoof-solaris  (2.4) new to 1.4.0
spoof-solaris2 (1.1) new to 1.4.0
sysinfo.c - new to 1.4.1 (thanks to an anonymous contributor)
dloverlay.c - new to 1.4.3 
X     contributed by bf078@cleveland.Freenet.Edu (Brian S Walden)
XX86 support - thanks to Bogdan Urma <bogdan@xandau.com> for the use
X     of an X86 machine running Solaris 2.4
SC1000 nvram.info - thanks to Kevin Murty for use of an SS1000
nvram.info updates for 1.4.7, 1.4.8, 1.4.9
see the file changelog for more info
Solaris 2.5 support (note for versions which embedd a new sethostid call
X  you must now define -DPRE_SOLARIS_2_5 in the makefile to run these under
X  Solaris 2.3 or 2.4) in 1.6.0
X
spoof-solaris and spoof-solaris2 allow you to spoof hostname, hostid,
and IP address in much the same way as hostid.
SHAR_EOF
chmod 0600 hid-1.6.1/00README.FIRST ||
echo 'restore of hid-1.6.1/00README.FIRST failed'
Wc_c="`wc -c < 'hid-1.6.1/00README.FIRST'`"
test 8207 -eq "$Wc_c" ||
	echo 'hid-1.6.1/00README.FIRST: original size 8207, current size' "$Wc_c"
fi
true || echo 'restore of hid-1.6.1/INSTRUCTIONS failed'
echo End of part 2, continue with part 3
exit 0
-- 
Mark Henderson -- markh@wimsey.bc.ca, henderso@netcom.com (personal accounts)
ViaCrypt PGP Key Fingerprint: 21 F6 AF 2B 6A 8A 0B E1  A1 2A 2A 06 4A D5 92 46
cryptography archive maintainer -- ftp://ftp.wimsey.com/pub/crypto
ftp://ftp.wimsey.com/pub/crypto/sun-stuff/change-sun-hostid-1.6.1.tar.gz


