The ttysnoop package in redhat contrib is broken, and has been
for ages.  Looks like it must have been a 'first try' for the
submitter that doesn't work...

I got the src RPM:  ttysnoop-0.12c-5.src.rpm

And am trying to build it.  It includes 2 patch files.  One that
supposedly patches the Makefile, and another that patches it for
glibc support.  Neither patch succeeds during the rpm build
process, and so the package is useless.

I decided to roll my own RPM from scratch instead.  So, I
extracted the tarball out of the rpm file, and am trying to build
ttysnoop by hand.  I'm having some trouble though, and would like
a hand.

1 root@asdf:/usr/src/redhat/SOURCES/ttysnoop-0.12c# make
gcc -O2 -c -o ttysnoops.o ttysnoops.c
In file included from ttysnoops.c:25:
/usr/include/linux/time.h:69: warning: `FD_SET' redefined
/usr/include/sys/select.h:63: warning: this is the location of
the previous definition
/usr/include/linux/time.h:70: warning: `FD_CLR' redefined
/usr/include/sys/select.h:64: warning: this is the location of
the previous definition
/usr/include/linux/time.h:71: warning: `FD_ISSET' redefined
/usr/include/sys/select.h:65: warning: this is the location of
the previous definition
/usr/include/linux/time.h:72: warning: `FD_ZERO' redefined
/usr/include/sys/select.h:66: warning: this is the location of
the previous definition
In file included from /usr/include/bits/utmp.h:24,
                 from /usr/include/utmp.h:30,
                 from ttysnoops.c:37:
/usr/include/sys/time.h:78: warning: `ITIMER_REAL' redefined
/usr/include/linux/time.h:78: warning: this is the location of
the previous definition
/usr/include/sys/time.h:81: warning: `ITIMER_VIRTUAL' redefined
/usr/include/linux/time.h:79: warning: this is the location of
the previous definition
/usr/include/sys/time.h:85: warning: `ITIMER_PROF' redefined
/usr/include/linux/time.h:80: warning: this is the location of
the previous definition
In file included from ttysnoops.c:25:
/usr/include/linux/time.h:9: redefinition of `struct timespec'
/usr/include/linux/time.h:51: parse error before `suseconds_t'
/usr/include/linux/time.h:51: warning: no semicolon at end of
struct or union
/usr/include/linux/time.h:88: field `it_interval' has incomplete
type
/usr/include/linux/time.h:89: field `it_value' has incomplete
type
In file included from /usr/include/bits/utmp.h:24,
                 from /usr/include/utmp.h:30,
                 from ttysnoops.c:37:
/usr/include/sys/time.h:47: redefinition of `struct timezone'
/usr/include/sys/time.h:77: parse error before `0'
/usr/include/sys/time.h:91: redefinition of `struct itimerval'
ttysnoops.c: In function `authenticate':
ttysnoops.c:343: warning: passing arg 2 of `strcmp' makes pointer
from integer without a cast
make: *** [ttysnoops.o] Error 1



Ok, I looked at the errors, and edited the ttysnoops.c file, and
commented out the line that includes linux/time.h.  Why should a
userland app like this require a kernel header?  It's gone.

Now I get:

1 root@asdf:/usr/src/redhat/SOURCES/ttysnoop-0.12c# make
gcc -O2 -c -o ttysnoops.o ttysnoops.c
ttysnoops.c: In function `authenticate':
ttysnoops.c:343: warning: passing arg 2 of `strcmp' makes pointer
from integer without a cast
gcc -O2 -c -o common.o common.c
gcc ttysnoops.o common.o -o ttysnoops
ttysnoops.o: In function `authenticate':
ttysnoops.o(.text+0x6ac): undefined reference to `crypt'
collect2: ld returned 1 exit status
make: *** [ttysnoops] Error 1


Much better...  Here is line 343 from ttysnoops.c:

#ifndef SHADOW_PWD
         if (strcmp(pw->pw_passwd,crypt(buff, pw->pw_passwd)) == 0)
#else


I change it to:

#ifndef SHADOW_PWD
         if (strcmp(pw->pw_passwd,(char *) crypt(buff, pw->pw_passwd)) == 0)
#else


Now I make clean ; make again.

1 root@asdf:/usr/src/redhat/SOURCES/ttysnoop-0.12c# make
gcc -O2 -c -o ttysnoops.o ttysnoops.c
gcc -O2 -c -o common.o common.c
gcc ttysnoops.o common.o -o ttysnoops
ttysnoops.o: In function `authenticate':
ttysnoops.o(.text+0x6ac): undefined reference to `crypt'
collect2: ld returned 1 exit status
make: *** [ttysnoops] Error 1


Looks like some library is missing, or something.  I just turned
on "-Wall", and it looks like countless errors and warnings
abound...  GRR.

Very shoddy programming I guess...  Oh well.  Can't begrudge a
peer OS developer I guess...

Anyone care to help me redo the ttysnoop package so that it is
functional AND maintainable, and follows good programming
practice?

I'm going to tackle it right now and try and clean it up, but I'm
not sure I can get everything working or not...

Wish me luck.
TTYL


-- 
Mike A. Harris                                     Linux advocate     
Computer Consultant                                  GNU advocate  
Capslock Consulting                          Open Source advocate

... Our continuing mission: To seek out knowledge of C, to explore
strange UNIX commands, and to boldly code where no one has man page 4.




_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to