4833aac399199d9dbd91a7eb8d93b8e6f2245799
13 #include "auto_usera.h"
14 #include "auto_break.h"
17 #define GETPW_USERLEN 32
26 char username
[GETPW_USERLEN
];
29 extension
= local
+ str_len(local
);
31 if (extension
- local
< sizeof(username
))
32 if (!*extension
|| (*extension
== *auto_break
)) {
33 byte_copy(username
,extension
- local
,local
);
34 username
[extension
- local
] = 0;
35 case_lowers(username
);
36 pw
= getpwnam(username
);
39 if (stat(pw
->pw_dir
,&st
) == 0) {
40 if (st
.st_uid
== pw
->pw_uid
) {
42 if (*extension
) { ++extension
; dash
= "-"; }
47 if (error_temp(errno
)) _exit(QLX_NFS
);
49 if (extension
== local
) return 0;
61 if (!local
) _exit(100);
66 pw
= getpwnam(auto_usera
);
69 if (!pw
) _exit(QLX_NOALIAS
);
71 substdio_puts(subfdoutsmall
,pw
->pw_name
);
72 substdio_put(subfdoutsmall
,"",1);
73 substdio_put(subfdoutsmall
,num
,fmt_ulong(num
,(long) pw
->pw_uid
));
74 substdio_put(subfdoutsmall
,"",1);
75 substdio_put(subfdoutsmall
,num
,fmt_ulong(num
,(long) pw
->pw_gid
));
76 substdio_put(subfdoutsmall
,"",1);
77 substdio_puts(subfdoutsmall
,pw
->pw_dir
);
78 substdio_put(subfdoutsmall
,"",1);
79 substdio_puts(subfdoutsmall
,dash
);
80 substdio_put(subfdoutsmall
,"",1);
81 substdio_puts(subfdoutsmall
,extension
);
82 substdio_put(subfdoutsmall
,"",1);
83 substdio_flush(subfdoutsmall
);