Re: Help diagnosing NIS breakage ?

2003-07-17 Thread TOMITA Yoshinori
hi Bill,

>> On Thu, 17 Jul 2003 00:33:26 -0700 (PDT), [EMAIL PROTECTED] (Bill
>> Paul) said:


Bi> Gr. I don't know how I can keep getting this wrong. Ok, this
Bi> time I tested the change with a sample program. Try applying
Bi> http://www.freebsd.org/~wpaul/getpwent.diff again. Verify that
Bi> the result matches the file in the fbsd5 test account. The
Bi> getpwuid() routine seems to work ok, though my test for the
Bi> geteuid() == 0 case was a bit of a kludge since I don't actually
Bi> have root on the test box.

Bi> -Bill



I feel that the following else-clause is required to store map name
such as "passwd.byname" in variable buffer.


if (geteuid() == 0) {
if (snprintf(buffer, bufsize, "master.passwd.by%s",
(how == nss_lt_id) ? "uid" : "name") >= bufsize)
return (NS_UNAVAIL);
rv = yp_order(domain, buffer, &outname);
if (rv == 0)
*master = 1;
} else {
if (snprintf(buffer, bufsize, "passwd.by%s",
 (how == nss_lt_id) ? "uid" : "name") >= bufsize)
return (NS_UNAVAIL);
}





But I have not tested the code yet.


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


Re: Help diagnosing NIS breakage ?

2003-07-16 Thread TOMITA Yoshinori
Hi Bill, I have a question.

>> On Tue, 15 Jul 2003 10:44:15 -0700 (PDT), [EMAIL PROTECTED] (Bill
>> Paul) said:


B> I uploaded a new diff, please test this instead:

B> http://www.freebsd.org/~wpaul/getpwent.diff

B> Thanks for providing me access to this machine, it helped me realize
B> where I'd gone wrong in my patch. If this works for you, and if nobody
B> objects, I will check it in.


Is your patch "getpwent.diff" really for revision 1.82 ?
If so, nis_map() will be like this and I do not think this works.

-- -- -- -- -- 
static int
nis_map(char *domain, enum nss_lookup_type how, char *buffer, size_t bufsize,
int *master)
{
int rv;
char*outname;

*master = 0;
if (geteuid() == 0) {
if (snprintf(buffer, bufsize, "master.passwd.by%s",
(how == nss_lt_id) ? "uid" : "name") >= bufsize)
return (NS_UNAVAIL);
rv = yp_order(domain, buffer, &outname);
if (rv == 0)
*master = 1;
return (NS_UNAVAIL);
}

return (NS_SUCCESS);
}
-- -- -- -- -- 

In case of geteuid()==0, always NS_UNAVAIL returned
In case of geteuid()!=0, map name is not assigned to *buffer




I did not imagine my idea of yp_order() would break NIS with
ActiveDirectory, which I have never seen so far.

-- 
---
TOMITA Yoshinori

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


Re: passwd NIS+ YP compat mode

2003-05-27 Thread TOMITA Yoshinori
>> On Tue, 27 May 2003 21:46:04 +0900, TOMITA Yoshinori
>> <[EMAIL PROTECTED]> said:

T> Hello all,
T> After cvsup-ed today 2003-5-27 and make buildworld and so on,
T> NIS passwd database are completely ignored.
T> But NIS group database seems to be used as usual.

T> Out NIS server is actually NIS+ in YP comaptible mode.
T> I traced the function getpwnam() and reached following code.

T> What can I do ?


T> ==[getpwent.c]=
T> static int
T> nis_map(char *domain, enum nss_lookup_type how, char *buffer, size_t bufsize,
T> int *master)

T>...

T>  rv = yp_order(domain, buffer, &order); <-- this returns YPERR_YPERR
T>  if (rv == 0)
T>  return (NS_SUCCESS);

T> ==[yplib.c]=

T> int
T> yp_order(char *indomain, char *inmap, int *outorder)

T>...

T>  /*
T>   * NIS+ in YP compat mode doesn't support the YPPROC_ORDER
T>   * procedure.
T>   */
T>  if (r == RPC_PROCUNAVAIL) {
T>  return(YPERR_YPERR); <--- Here
T>  }
T> 



I hope this patch will solve this problem for users living under NIS+
servers.

I guess yp_order() is used to check masswd.by* or master.passwd.by*
databese really exists. yp_master() can be used for this purpose.  But
I do not know the cost of yp_master() compared to yp_order().


--- /usr/src/lib/libc/gen/getpwent.c.bakTue May 27 08:47:24 2003
+++ /usr/src/lib/libc/gen/getpwent.cWed May 28 09:35:50 2003
@@ -938,14 +938,15 @@
 nis_map(char *domain, enum nss_lookup_type how, char *buffer, size_t bufsize,
 int *master)
 {
-   int rv, order;
+   int rv;
+   char*outname;
 
*master = 0;
if (geteuid() == 0) {
if (snprintf(buffer, bufsize, "master.passwd.by%s",
(how == nss_lt_id) ? "uid" : "name") >= bufsize)
return (NS_UNAVAIL);
-   rv = yp_order(domain, buffer, &order);
+   rv = yp_master(domain, buffer, &outname);
if (rv == 0) {
*master = 1;
return (NS_SUCCESS);
@@ -954,7 +955,7 @@
if (snprintf(buffer, bufsize, "passwd.by%s",
(how == nss_lt_id) ? "uid" : "name") >= bufsize)
return (NS_UNAVAIL);
-   rv = yp_order(domain, buffer, &order);
+   rv = yp_master(domain, buffer, &outname);
if (rv == 0)
return (NS_SUCCESS);
return (NS_UNAVAIL);



-- 
---
TOMITA Yoshinori

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


su and SIGHUP problem

2003-01-22 Thread TOMITA Yoshinori
On 5.0-CURRENT cvsuped recently, I am seenig very similar problem
discussed in the following.

Subject:   zsh exits upon ^C after su'ing to root with zsh as its shell
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=368539+0+archive/2002/freebsd-current/20020602.freebsd-current

Subject:   su gets SIGHUP randomly on startup with latest current
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=673722+0+archive/2002/freebsd-current/20020630.freebsd-current


This is what I did. Anybody can reproduce this ?

% su
Password:
# suspend

Suspended (signal)
% fg
su
# suspend

Suspended (signal)
 repeat suspend and fg several times,
 and finaly shell(tcsh) gets SIGHUP

% fg
su

Suspended (tty output)
 SIGHUP occured here !


-- 
---
TOMITA Yoshinori

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: gcc 3.2.1 optimization bug ?

2002-11-14 Thread TOMITA Yoshinori
>> On Thu, 14 Nov 2002 17:37:50 -0800, David Schultz
>> <[EMAIL PROTECTED]> said:

Da> You can work around the problem by disabling -fschedule-insns or
Da> -fstrict-aliasing, both of which are turned on by -O2.  The latter
Da> option is the more direct cause of your problem, but for some
Da> reason only the combination of the two seems to generate incorrect
Da> output on i386.

Before posting that question here, one of my colleague advised me that
it may have something to do with "aliasing" feature.  I looked up the
option "-fstrict-aliasing" in gcc.info and tried:

   gcc -O2 -fstrict-aliasing ...

ha-ha... I should have read the info more carefully.
-fno-strict-alias also worked for it. Thanks.


-- 
TOMITA Yoshinori

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: gcc 3.2.1 optimization bug ?

2002-11-11 Thread TOMITA Yoshinori
>> On Mon, 11 Nov 2002 08:55:02 -0500 (EST), Thomas David Rivers <[EMAIL PROTECTED]> 
>said:

Th>  Several people have pointed out that using "volatile" will
Th>  help with your code.

Th>  But - even with the use of "volatile" - your code is invalid ANSI
Th>  C.
--snip--

Thanks for your detailed explanation. It cleared me more.


Th>  Your code appears to simply want to swap the two (assumed) words in
Th>  an integer.  That could be accomplished with shifts, etc...
Th>  This code makes all kinds of assumptions about the size of
Th>  `int' and `short' - but represents an alternative approach:

Th> unsigned int t;
Th> unsigned int x;

Th> t = (x & 0x) << 16;
Th> x >>= 16;
Th> x |= t;

Th>  Assuming `int' was 32-bits wide - this, or something similar,
Th>  might be a more portable approach.
 

Yes, I agree with your example code.

But unfortunately, that ugly code was contained in our inhouse library
written by someone.
It took me two days to debug and find out where difference comes from
between gcc-2.95.4 and gcc-3.2.1.


-- 
TOMITA Yoshinori


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: gcc 3.2.1 optimization bug ?

2002-11-11 Thread TOMITA Yoshinori
>> On Mon, 11 Nov 2002 13:55:17 +0100, Poul-Henning Kamp
>> <[EMAIL PROTECTED]> said:

P> Your code forgot to tell the compiler that you would be messing
P> with the variables storage directly.

Thanks!
I have never dreamed to use "volatile" here.
As gcc-2.95.x -O2/-O3 was OK without volatile, I thought this must be
gcc-3.2 bug.

Thanks a lot, again.

-- 
TOMITA Yoshinori

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



gcc 3.2.1 optimization bug ?

2002-11-11 Thread TOMITA Yoshinori
For the source code below, compiling gcc -O2/-O3 seem to produce
incorrect code.

---
#include 
int main(int argc, char* argv[])
{
unsigned int x = 0x12345678;
unsigned short tmp;
printf("%x\n", x);
tmp = ((unsigned short *)&x)[0];
((unsigned short *)&x)[0] = ((unsigned short *)&x)[1];
((unsigned short *)&x)[1] = tmp;
printf("%x\n", x);
return 0;
}
---


% gcc -O1 a.c
% ./a.out 
12345678
56781234

% gcc -O2 a.c
% ./a.out
12345678
12341234

% gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.2.1 [FreeBSD] 20021009 (prerelease)




Is this a gcc bug or the source code problem ?

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Re: NFS hang on rmdir(2) with 5.0-current client, server

2002-10-03 Thread TOMITA Yoshinori

I have seen something strange behavior related to NFS version 2.

NFS server is Solaris 2.6.
NFS client is 5-CURRENT, cvsuped today.

Using NFS version 2, I can create file but cannot append(?) to file.

[version2]

# mount_nfs -2 SERVER:/export/home/SOMEWHERE /mnt
 ...
$ echo > /mnt/aho
$ ls -l /mnt/aho
-rw-rw-r--  1 SOMEONE  SOMEGROUP  1 Oct  3 18:43 /mnt/aho
$ echo >> /mnt/aho
cannot create /mnt/aho: Permission denied



[version3]

# umount /mnt
# mount_nfs -3 SERVER:/export/home/SOMEWHERE /mnt
 ...
$ echo > /mnt/aho
$ ls -l /mnt/aho
-rw-rw-r--  1 SOMEONE  SOMEGROUP  1 Oct  3 18:44 /mnt/aho
$ echo "hello" >> /mnt/aho
$ ls -l /mnt/aho
-rw-rw-r--  1 SOMEONE  SOMEGROUP  7 Oct  3 18:44 /mnt/aho

-- 
---
TOMITA Yoshinori


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



No Subject

2001-08-29 Thread TOMITA Yoshinori

subscribe freebsd-current

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message