Ownership

Essyug essyug at free.fr
Tue Sep 28 16:13:22 GMT 2004


>>How can I check whether rsync uses /etc/nsswitch.conf or not?
> 
> 
> I'd suggest finding a Linux forum to ask that question (and first
> googling to see if the answer is already out there).  I'd also suggest
> creating a simple test program that just tries to lookup "testuser"
> using getpwnam() (you could easily tweak the code I sent in a message
> just recently as a good start for such a program).  Try running that,
> ensure that it fails in a similar manner, and then look for information
> on getting that test program to work.

It seems to work correctly (warning, ugly piece of code ahead):

#-------------------------
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <sys/types.h>

int main(void)
{
  char name[9] = "testuser\0" ;
  uid_t *uid;
  struct passwd *pass;

  pass = getpwnam(name);
  if (pass) {
         *uid = pass->pw_uid;
         fprintf(stderr,"Lookup of `%s' returned %ld\n",name,(long)*uid);
         return 1;
  }
  fprintf(stderr,"Lookup of `%s' failed\n",name);
  return 0;
}
#-------------------------

./name2uid
Lookup of `testuser' returned 10000




More information about the rsync mailing list