Re: usbd config file parse behaviour

2004-03-28 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]>
Bernd Walter <[EMAIL PROTECTED]> writes:
: On Sat, Mar 27, 2004 at 04:55:56PM -0700, M. Warner Losh wrote:
: > In message: <[EMAIL PROTECTED]>
: > Bernd Walter <[EMAIL PROTECTED]> writes:
: > : I'm working on getting devd(8) usable for usb devices.
: > 
: > The part I'm not sure about is where you add the pnpinfo to the
: > devaddq stuff.  All that stuff should generally be in devaddq.  Why
: > did you did it the way you did and what were you able to gain by it?
: 
: Fact is that we need more information then available for attach/detach
: statements right now to replace usbd - especially the serial number of
: a device was the part that I'm interested in.

OK.  That makes sense.

: What still puzzles me is why pnpinfo is currently only part in case of
: unassigned new devices - it looks intentionaly to be left out for other
: cases - therefor the current patch just adds it in the most simple way
: to test the other part and was never intended as a commit candidate.
: Do you think there could be problems with pnpinfo for other type of
: devices (cardbus, pcmcia, acpi, ...)?

No problems.  I didn't add it because I originally thought that devd
could look up the device and tease it out.  However, it would be
convenient to have this information at hand, and it does eliminate a
potential race condition to provide it all at once.  The only thing I
worry about it exceeding some static limit in devd/devctl.  And if we
do, we can increase it because we malloc things in the kernel and
having a bigger userland buffer isn't going to hurt.

I'll look into these issues and see how hard this will be.

Btw, any interest in making it possible to kldload a usb module and
having device attach to it?  Right now the usb code assumes that you
can unplug the device and replug it back in.  I have at least two
devices on my laptop that can't be removed (bluetooth and memory stick
reader), so I can't dynamically load drivers for them...

Warner
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


pthread problems

2004-03-28 Thread Jeff Mitchell
Hackers--

I'm having major troubles upgrading my ports, and nearly all of them are related to 
pthreads in some way or another.  After trying to troubleshoot a lot of these 
individually, I'm at the point of thinking I should redo my pthread libraries...it 
seems like something's very messed up internally.

I've been Googling and searching newsgroups and all sorts of stuff but just can't 
really find anything that helps.

For reference, my system is a 5.2R upgraded to 5.2.1R via cvsup.  After taking a quick 
look at some of the issues I'm having below, can anyone tell me what course of action 
I should pursue (i.e. how to figure out what's going wrong with everything, or if I 
should try redoing my pthreads libraries, or what) and how I should do that action?

I know I have pthreads installed (see the openldap error), and linuxthreads are 
installed too (although configure scripts don't seem to find those)...see the openldap 
error, again).

Here's a couple of examples.  For each pair, the portupgrade error is shown on the 
first lines, the relevant builld/configure/link error on the following lines:

! devel/commoncpp (commoncpp2-1.0.8_1,1)(compiler error)
thread.cpp:1081: error: `pthread_yield' undeclared (first use this function)

! deskutils/xchm (xchm-0.8.11)  (linker error)
/usr/X11R6/lib/libwx_gtk2-2.4.so: undefined reference to `pthread_yield_np'

! devel/libsigcx (libsigcx-0.6.4)   (linker error)
../sigcx/.libs/libsigcx-0.6.so: undefined reference to `pthread_yield_np'

! audio/arts (arts-1.1.4,1) (compiler error)
threads_posix.cc: In member function `virtual void 
   Arts::PosixThreads::Thread_impl::setPriority(int)':
threads_posix.cc:190: error: aggregate `sched_param sp' has incomplete type and 
   cannot be defined
threads_posix.cc:192: error: `SCHED_FIFO' undeclared (first use this function)

! x11-fm/gnome-commander (gnome-commander-1.0.1_1)  (linker error)
gnome-cmd-delete-dialog.o: In function `reply_callback':
gnome-cmd-delete-dialog.o(.text+0x698): undefined reference to `__pthread_detach'

! deskutils/xchm (xchm-0.8.11)  (linker error)
/usr/X11R6/lib/libwx_gtk2-2.4.so: undefined reference to `pthread_yield_np'

! net/openldap21-client (openldap-client-2.1.23)(configure error)
checking for GNU Pth pthread.h... yes
checking for pthread_create in default libraries... no
checking for pthread link with -kthread... no
checking for pthread link with -pthread... no
checking for pthread link with -pthreads... no
checking for pthread link with -mthreads... no
checking for pthread link with -thread... no
checking for pthread link with -lpthread -lmach -lexc -lc_r... no
checking for pthread link with -lpthread -lmach -lexc... no
checking for pthread link with -lpthread -Wl,-woff,85... no
checking for pthread link with -lpthread... Segmentation fault (core dumped)
no
checking for pthread link with -lc_r... no
checking for pthread link with -threads... no
checking for pthread link with -lpthreads -lmach -lexc -lc_r... no
checking for pthread link with -lpthreads -lmach -lexc... no
checking for pthread link with -lpthreads -lexc... no
checking for pthread link with -lpthreads... no
configure: error: could not locate usable POSIX Threads

It goes on and on.  I've attached the output from "ls /var/db/pkg" but don't know what 
else would help.  If anyone needs anything more, just let me know.  Any help is 
appreciated.

Thanks,
Jeff

pkglist
Description: Binary data
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: usbd config file parse behaviour

2004-03-28 Thread Bernd Walter
On Sun, Mar 28, 2004 at 01:31:03AM -0700, M. Warner Losh wrote:
> In message: <[EMAIL PROTECTED]>
> Bernd Walter <[EMAIL PROTECTED]> writes:
> : On Sat, Mar 27, 2004 at 04:55:56PM -0700, M. Warner Losh wrote:
> : > In message: <[EMAIL PROTECTED]>
> : > Bernd Walter <[EMAIL PROTECTED]> writes:
> : > : I'm working on getting devd(8) usable for usb devices.
> : > 
> : > The part I'm not sure about is where you add the pnpinfo to the
> : > devaddq stuff.  All that stuff should generally be in devaddq.  Why
> : > did you did it the way you did and what were you able to gain by it?
> : 
> : Fact is that we need more information then available for attach/detach
> : statements right now to replace usbd - especially the serial number of
> : a device was the part that I'm interested in.
> 
> OK.  That makes sense.
> 
> : What still puzzles me is why pnpinfo is currently only part in case of
> : unassigned new devices - it looks intentionaly to be left out for other
> : cases - therefor the current patch just adds it in the most simple way
> : to test the other part and was never intended as a commit candidate.
> : Do you think there could be problems with pnpinfo for other type of
> : devices (cardbus, pcmcia, acpi, ...)?
> 
> No problems.  I didn't add it because I originally thought that devd
> could look up the device and tease it out.  However, it would be
> convenient to have this information at hand, and it does eliminate a
> potential race condition to provide it all at once.  The only thing I
> worry about it exceeding some static limit in devd/devctl.  And if we
> do, we can increase it because we malloc things in the kernel and
> having a bigger userland buffer isn't going to hurt.
> 
> I'll look into these issues and see how hard this will be.

Thanks.

> Btw, any interest in making it possible to kldload a usb module and
> having device attach to it?  Right now the usb code assumes that you
> can unplug the device and replug it back in.  I have at least two
> devices on my laptop that can't be removed (bluetooth and memory stick
> reader), so I can't dynamically load drivers for them...

I'll think about it.
Reprobing is not so much an issue as selecting an interface for it.

-- 
B.Walter   BWCThttp://www.bwct.de
[EMAIL PROTECTED]  [EMAIL PROTECTED]

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Problem with usb in FreeBSD 4.8....help!!!

2004-03-28 Thread jitendra pande
Hi,
 
I have stuck with a problem with usb devices.
 
In case of FreeBSD 4.8, whenever a new USB device is attached to the system, no device 
node is dynamically being created within the dev file system.
 
This is in contrast to the behavior there with FreeBSD 5.0 where a new device node is 
being  created on attaching a new USB device, Fox example when first USB device is 
attached then /dev/ugen0 node is created dynamically in dev file system. when 2nd 
device is added then /dev/ugen1 and so on .ugen2, ugen3...
 
On the other hand with freeBSD 4.8 there exist some static device node /dev/ugen0, 
/dev/ugen0.x where x =1-16 within the /dev file system.
 
My application uses libusb for iinteracting with the usb devices...libusb on freeBSD 
4.8 tries to find /debv/ugen0, /dev/ugen1 and so onhence couldn't able to detect 
more then one device.
 
It would really be great if someone can help me in resolving the issue Any idea why 
this changes in the behavior with  FreeBSD 4.8 and FreeBSD 5.0
 
Any help will be highly appreciated.
 
 
Thanks
Jitendra




-
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


MS_ASYNC with MS_INVALIDATE

2004-03-28 Thread Mark Terribile

Greetings,

A friend asked me to run some Linux source on FreeBSD.  It simulates a data
pool management system he is using, and it includes a call msync(2) with
both the MS_ASYNC and MS_INVALIDATE flags.  FreeBSD does not allow this.
(I tested it on my 4.8 system; I'll have access to a 5.1 system on Monday.)
I ran it without the MS_ASYNC, and got very different results from the ones
he reported on Linux.  I'd like to be able to explain what's happening.

Would someone please shed some light on why this combination of flags is
disallowed, and what the intended semantics are?  I suspect that either I
or he has a subtle misunderstanding here.

I'm not a regular reader of freebsd-hackers, so I would especially appreciate
a direct copy of any reply.

Thank you all for your time.

Mark Terribile
[EMAIL PROTECTED]


__
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Problem with usb in FreeBSD 4.8....help!!!

2004-03-28 Thread Bernd Walter
On Sun, Mar 28, 2004 at 02:51:56AM -0800, jitendra pande wrote:
> Hi,
>  
> I have stuck with a problem with usb devices.
>  
> In case of FreeBSD 4.8, whenever a new USB device is attached to the system, no 
> device node is dynamically being created within the dev file system.
>  
> This is in contrast to the behavior there with FreeBSD 5.0 where a new device node 
> is being  created on attaching a new USB device, Fox example when first USB device 
> is attached then /dev/ugen0 node is created dynamically in dev file system. when 2nd 
> device is added then /dev/ugen1 and so on .ugen2, ugen3...
>  
> On the other hand with freeBSD 4.8 there exist some static device node /dev/ugen0, 
> /dev/ugen0.x where x =1-16 within the /dev file system.
>  
> My application uses libusb for iinteracting with the usb devices...libusb on freeBSD 
> 4.8 tries to find /debv/ugen0, /dev/ugen1 and so onhence couldn't able to detect 
> more then one device.
>  
> It would really be great if someone can help me in resolving the issue Any idea why 
> this changes in the behavior with  FreeBSD 4.8 and FreeBSD 5.0

You are expected to create devnodes manualy in 4.x.
/dev/MAKEDEV script will help you.
See MAKEDEV manpage for details or read the handbook.

-- 
B.Walter   BWCThttp://www.bwct.de
[EMAIL PROTECTED]  [EMAIL PROTECTED]

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: MS_ASYNC with MS_INVALIDATE

2004-03-28 Thread Dan Nelson
In the last episode (Mar 27), Mark Terribile said:
> A friend asked me to run some Linux source on FreeBSD.  It simulates
> a data pool management system he is using, and it includes a call
> msync(2) with both the MS_ASYNC and MS_INVALIDATE flags.  FreeBSD
> does not allow this. (I tested it on my 4.8 system; I'll have access
> to a 5.1 system on Monday.) I ran it without the MS_ASYNC, and got
> very different results from the ones he reported on Linux.  I'd like
> to be able to explain what's happening.
> 
> Would someone please shed some light on why this combination of flags
> is disallowed, and what the intended semantics are?  I suspect that
> either I or he has a subtle misunderstanding here.

Does that even make sense?  How could you simultaneously request that
all modified pages be queued for writing to disk AND that all modified
pages be discarded?  If you discard them, then there's nothing for the
kernel to write.  This has been an invalid request as long as FreeBSD
has supported msync flags:

revision 1.20
date: 1995/03/25 17:36:00;  author: davidg;  state: Exp;  lines: +6 -3
Disallow both MS_ASYNC and MS_INVALIDATE flags being set at the same time
in msync().

revision 1.19
date: 1995/03/25 16:55:46;  author: davidg;  state: Exp;  lines: +11 -14
Added "flags" argument to msync, and implemented MS_ASYNC and MS_INVALIDATE.
The MS_ASYNC flag doesn't current work, and MS_INVALIDATE will only toss out
the pages in the address space (not all pages in the shadow chain).

I don't know if MS_ASYNC currently works; alc would be the person to
ask about it, since it looks like he worked on msync and vm_map_sync in
November.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: off topic - disk crash

2004-03-28 Thread John-Mark Gurney
Christoph P. Kukulies wrote this message on Sun, Mar 14, 2004 at 13:04 +0100:
> Some time ago I wrote a little program to scan a disk for the start of 
> a FS. Unfortunately that program is also on the crashed disk :-O

Since you are on 4.8-R you can take a look at ffsrecov.  I wrote this
program a while back to try to recover data...  This program might be
able to help you since it will only read minimal amounts of data.. it
also will scan for superblocks and report where it believes the begining
of the FS is...  it also has a mode where you can give it a block number
and it will tell you what part of the fs the block is allocated to, be
it inode, or data, or free...

-- 
  John-Mark Gurney  Voice: +1 415 225 5579

 "All that I will do, has been done, All that I have, has not."
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


fsck fails - mark sectors as bad?

2004-03-28 Thread Dan Langille
I had a hard drive failure.  I'm trying to get as much data off it as
I can before I restore from backup.  I have mounted the drive in
another box and I'm attempting to salvage what I can.

I thought I might be able to mark the bad sectors as bad, and get the 
file system mounted.

Here is what fsk -y finds:

 # fsck -y /dev/ad2s1a
** /dev/ad2s1a
** Last Mounted on /
** Phase 1 - Check Blocks and Sizes

CANNOT READ: BLK 3168
CONTINUE? yes

THE FOLLOWING DISK SECTORS COULD NOT BE READ: 3187, 3188, 3189, 3190, 
3191, 3192, 3194,
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
1649 files, 40205 used, 24290 free (162 frags, 3016 blocks, 0.3% 
fragmentation)

* FILE SYSTEM STILL DIRTY *

* PLEASE RERUN FSCK *

# fsck -y /dev/ad2s1f
** /dev/ad2s1f
** Last Mounted on /tmp
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
UNREF FILE I=1420  OWNER=1004 MODE=100600
SIZE=7711 MTIME=Mar 27 15:06 2004
CLEAR? yes

UNREF FILE I=1462  OWNER=1004 MODE=100600
SIZE=4873 MTIME=Mar 27 14:10 2004
CLEAR? yes

UNREF FILE I=1463  OWNER=1004 MODE=100600
SIZE=44426 MTIME=Mar 27 14:10 2004
CLEAR? yes

UNREF FILE I=1464  OWNER=1004 MODE=100600
SIZE=1784 MTIME=Mar 27 15:05 2004
CLEAR? yes

UNREF FILE I=1466  OWNER=1004 MODE=100600
SIZE=443 MTIME=Mar 27 14:11 2004
CLEAR? yes

UNREF FILE I=1467  OWNER=1004 MODE=100600
SIZE=4873 MTIME=Mar 27 14:26 2004
CLEAR? yes

UNREF FILE I=1470  OWNER=1004 MODE=100600
SIZE=15571 MTIME=Mar 27 15:05 2004
CLEAR? yes

UNREF FILE I=1472  OWNER=1004 MODE=100600
SIZE=3836 MTIME=Mar 27 15:47 2004
CLEAR? yes

UNREF FILE I=1477  OWNER=1004 MODE=100600
SIZE=58635 MTIME=Mar 27 14:09 2004
CLEAR? yes

UNREF FILE I=1478  OWNER=1004 MODE=100600
SIZE=22808 MTIME=Mar 27 14:09 2004
CLEAR? yes

UNREF FILE I=1479  OWNER=1004 MODE=100600
SIZE=55863 MTIME=Mar 27 14:09 2004
CLEAR? yes

UNREF FILE I=1480  OWNER=1004 MODE=100600
SIZE=2879 MTIME=Mar 27 14:10 2004
CLEAR? yes

UNREF FILE I=1481  OWNER=1004 MODE=100600
SIZE=473 MTIME=Mar 27 14:11 2004
CLEAR? yes

** Phase 5 - Check Cyl groups
FREE BLK COUNT(S) WRONG IN SUPERBLK
SALVAGE? yes

SUMMARY INFORMATION BAD
SALVAGE? yes

BLK(S) MISSING IN BIT MAPS
SALVAGE? yes

2168 files, 3148 used, 125851 free (35 frags, 15727 blocks, 0.0% 
fragmentation)

* FILE SYSTEM MARKED CLEAN *

* FILE SYSTEM WAS MODIFIED *

# fsck -y /dev/ad2s1e
** /dev/ad2s1e
** Last Mounted on /var
** Phase 1 - Check Blocks and Sizes
INCORRECT BLOCK COUNT I=2044 (36 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2050 (4 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2111 (28 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2211 (4 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2236 (4 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2238 (64 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2240 (60 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2252 (4 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2257 (4 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2267 (4 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2283 (28 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2284 (28 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2287 (4 should be 0)
CORRECT? yes

INCORRECT BLOCK COUNT I=2389 (4 should be 0)
CORRECT? yes


^C^C^C^C

this froze up and I found this in /var/log/messages:

Mar 28 17:11:31 tmp /kernel: ad2s1a: hard error reading fsbn 6399 of 
3168-3295 (ad2s1 bn 6399; cn 0 tn 101 sn 36) trying PIO mode
Mar 28 17:11:31 tmp /kernel: ad2: DMA problem fallback to PIO mode
Mar 28 17:11:36 tmp /kernel: ad2s1a: hard error reading fsbn 6415 of 
3168-3295 (ad2s1 bn 6415; cn 0 tn 101 sn 52) status=59 error=4
0
Mar 28 17:11:41 tmp /kernel: ad2s1a: hard error reading fsbn 3187 
(ad2s1 bn 3187; cn 0 tn 50 sn 37) status=59 error=40
Mar 28 17:11:46 tmp /kernel: ad2s1a: hard error reading fsbn 3188 
(ad2s1 bn 3188; cn 0 tn 50 sn 38) status=59 error=40
Mar 28 17:11:51 tmp /kernel: ad2s1a: hard error reading fsbn 3189 
(ad2s1 bn 3189; cn 0 tn 50 sn 39) status=59 error=40
Mar 28 17:11:56 tmp /kernel: ad2s1a: hard error reading fsbn 3190 
(ad2s1 bn 3190; cn 0 tn 50 sn 40) status=59 error=40
Mar 28 17:12:01 tmp /kernel: ad2s1a: hard error reading fsbn 3191 
(ad2s1 bn 3191; cn 0 tn 50 sn 41) status=59 error=40
Mar 28 17:12:06 tmp /kernel: ad2s1a: hard error reading fsbn 3192 
(ad2s1 bn 3192; cn 0 tn 50 sn 42) status=59 error=40
Mar 28 17:12:11 tmp /kernel: ad2s1a: hard error reading fsbn 3194 
(ad2s1 bn 3194; cn 0 tn 50 sn 44) status=59 error=40
Mar 28 17:13:24 tmp /kernel: ad2: READ command timeout tag=0 serv=0 - 
resetting
Mar 28 17:13:24 tmp /kernel: ata1: resetting devices .. ata1-slave: 
ATA identify retries exceeded
Mar 28 17:13:24 tmp /kernel: done


# fsck -y /dev/ad2s1g
** /dev/ad2s1g
** Last Mounted on /usr
** Phase 1 - Check Blocks and Sizes

CANNOT READ: BLK 40829792
UNEXPECTED SOFT UPDATE I

Re: Problem with usb in FreeBSD 4.8....help!!!

2004-03-28 Thread Toni Andjelkovic
On Sun, Mar 28 2004 (02:51:56 -0800), jitendra pande wrote:
> My application uses libusb for iinteracting with the usb devices...
> libusb on freeBSD 4.8 tries to find /debv/ugen0, /dev/ugen1 and so
> onhence couldn't able to detect more then one device.
...
> FreeBSD 4.8 and FreeBSD 5.0

Note that the port version of libusb (0.1.7_1) ignores device endpoints
(/dev/ugenX.Y), so it may be necessary to find and open them by yourself.

Also note that opening the control endpoint (/dev/ugen0) instead
will prevent libusb from finding the device, because FreeBSD allows
the control endpoint to be open only once:

usb_os_find_devices: couldn't open device /dev/ugen0: Device busy

Also note that on 5.x (or -CURRENT) there are other problems to
watch out for:

http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/63375

Cheers,
Toni
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Question regarding shell user creation at login time

2004-03-28 Thread Ganbold
Hi,

I traced sshd using ktrace and it says:
..
 10198 new  CALL  setuid(0)
 10198 new  RET   setuid -1 errno 1 Operation not permitted
 10198 new  CALL  execve(0x80485d0,0xbfbfed8c,0xbfbfed94)
 10198 new  NAMI  "/home/new/new.pl"
 10198 new  RET   execve -1 errno 13 Permission denied
 10198 new  CALL  exit(0x)
.
My C program is:

#include 

main(ac, av)
char **av;
{
setuid(0);
execv("/home/new/new.pl",av);
}
Directory:

public# ls -la ~new
total 46
drwxr-xr-x  2 root  wheel512 Mar 29 09:10 .
drwxr-xr-x  8 root  wheel512 Mar 25 15:28 ..
-r--r-  1 root  new  767 Mar 24 17:43 .cshrc
-r--r-  1 root  new  248 Mar 26 12:32 .login
-r--r-  1 root  new  158 Mar 24 17:43 .login_conf
-r--r-  1 root  new  373 Mar 24 17:43 .mail_aliases
-r--r-  1 root  new  331 Mar 24 17:43 .mailrc
-r--r-  1 root  new  797 Mar 24 17:43 .profile
-r--r-  1 root  new  276 Mar 24 17:43 .rhosts
-r--r-  1 root  new  975 Mar 24 17:43 .shrc
-rwsr-x---  1 root  new 4651 Mar 26 08:47 new
--  1 root  wheel 94 Mar 26 08:47 new.c
-r-x--  1 root  wheel  15430 Mar 25 15:16 new.pl
-rw-r--r--  1 root  wheel 52 Mar 25 16:52 new.sh
Can somebody tell me the reason why it is failed?

Thanks in advance,

Ganbold

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Question regarding shell user creation at login time

2004-03-28 Thread Sean Kelly
Please don't crosspost.
I don't think this is a topic for -current, so I've removed it.

On Mon, Mar 29, 2004 at 11:05:55AM +0900, Ganbold wrote:
>  10198 new  CALL  setuid(0)
>  10198 new  RET   setuid -1 errno 1 Operation not permitted

Your attempt to setuid(0) failed.

>  10198 new  CALL  execve(0x80485d0,0xbfbfed8c,0xbfbfed94)
>  10198 new  NAMI  "/home/new/new.pl"
>  10198 new  RET   execve -1 errno 13 Permission denied

Your attempt to run that perl script failed.

> -rwsr-x---  1 root  new 4651 Mar 26 08:47 new
> --  1 root  wheel 94 Mar 26 08:47 new.c
> -r-x--  1 root  wheel  15430 Mar 25 15:16 new.pl

Well, since your attempt to setuid(0) failed, `new.pl` is not being
execve()'d as root. Therefore, the permissions on the `new.pl` file are
such that it can't be read or executed by the user/process.

-- 
Sean Kelly  | PGP KeyID: D2E5E296
[EMAIL PROTECTED] | http://www.sean-kelly.org/


pgp0.pgp
Description: PGP signature


Re: Question regarding shell user creation at login time

2004-03-28 Thread Robert Watson

On Mon, 29 Mar 2004, Ganbold wrote:

> Hi,
> 
> I traced sshd using ktrace and it says:
> ..
>   10198 new  CALL  setuid(0)
>   10198 new  RET   setuid -1 errno 1 Operation not permitted
>   10198 new  CALL  execve(0x80485d0,0xbfbfed8c,0xbfbfed94)
>   10198 new  NAMI  "/home/new/new.pl"
>   10198 new  RET   execve -1 errno 13 Permission denied
>   10198 new  CALL  exit(0x)
> .

Don't you mean to be running /home/new/new instead?  new.pl isn't world
readable/executable. 

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]  Senior Research Scientist, McAfee Research


> 
> My C program is:
> 
> #include 
> 
> main(ac, av)
>  char **av;
> {
>  setuid(0);
>  execv("/home/new/new.pl",av);
> }
> 
> Directory:
> 
> public# ls -la ~new
> total 46
> drwxr-xr-x  2 root  wheel512 Mar 29 09:10 .
> drwxr-xr-x  8 root  wheel512 Mar 25 15:28 ..
> -r--r-  1 root  new  767 Mar 24 17:43 .cshrc
> -r--r-  1 root  new  248 Mar 26 12:32 .login
> -r--r-  1 root  new  158 Mar 24 17:43 .login_conf
> -r--r-  1 root  new  373 Mar 24 17:43 .mail_aliases
> -r--r-  1 root  new  331 Mar 24 17:43 .mailrc
> -r--r-  1 root  new  797 Mar 24 17:43 .profile
> -r--r-  1 root  new  276 Mar 24 17:43 .rhosts
> -r--r-  1 root  new  975 Mar 24 17:43 .shrc
> -rwsr-x---  1 root  new 4651 Mar 26 08:47 new
> --  1 root  wheel 94 Mar 26 08:47 new.c
> -r-x--  1 root  wheel  15430 Mar 25 15:16 new.pl
> -rw-r--r--  1 root  wheel 52 Mar 25 16:52 new.sh
> 
> 
> Can somebody tell me the reason why it is failed?
> 
> Thanks in advance,
> 
> Ganbold
> 
> ___
> [EMAIL PROTECTED] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
> 

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Question regarding shell user creation at login time

2004-03-28 Thread Dan Nelson
In the last episode (Mar 28), Sean Kelly said:
> On Mon, Mar 29, 2004 at 11:05:55AM +0900, Ganbold wrote:
> >  10198 new  CALL  setuid(0)
> >  10198 new  RET   setuid -1 errno 1 Operation not permitted
> 
> Your attempt to setuid(0) failed.
> 
> >  10198 new  CALL  execve(0x80485d0,0xbfbfed8c,0xbfbfed94)
> >  10198 new  NAMI  "/home/new/new.pl"
> >  10198 new  RET   execve -1 errno 13 Permission denied
> 
> Your attempt to run that perl script failed.
> 
> > -rwsr-x---  1 root  new 4651 Mar 26 08:47 new
> > --  1 root  wheel 94 Mar 26 08:47 new.c
> > -r-x--  1 root  wheel  15430 Mar 25 15:16 new.pl
> 
> Well, since your attempt to setuid(0) failed, `new.pl` is not being
> execve()'d as root. Therefore, the permissions on the `new.pl` file are
> such that it can't be read or executed by the user/process.

Ah, but if he is in fact running /home/new/new, which is setuid root,
then the setuid(0) call (redundant) should have worked, and so should
the exec.

Ganbold: if you run /home/new/new as an ordinary user, does it work?  I
can't think of how ssh would be nullifying the setuid bit on that
binary, but you never know.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"