C<dump()>, C<chown()>, C<link()>, C<symlink()>, C<chroot()>,
C<setpgrp()> and related security functions, C<setpriority()>,
C<getpriority()>, C<syscall()>, C<fcntl()>, C<getpw*()>,
-C<getlogin()>, C<wait*()>, C<msg*()>, C<shm*()>, C<sem*()>,
-C<ioctl()>, C<alarm()>, C<socketpair()>, C<*netent()>, C<*protoent()>,
-C<*servent()>, C<*hostent()>, C<getnetby*()>.
+C<wait*()>, C<msg*()>, C<shm*()>, C<sem*()>, C<ioctl()>, C<alarm()>,
+C<socketpair()>, C<*netent()>, C<*protoent()>, C<*servent()>,
+C<*hostent()>, C<getnetby*()>.
This list is possibly incomplete.
=item *
d_setgrps='undef'
d_gethent='undef'
d_gethname='undef'
-d_getlogin='undef'
+d_getlogin='define'
d_getpgrp2='undef'
d_getpgrp='undef'
d_getpgid='undef'
d_setgrps='undef'
d_gethent='undef'
d_gethname='undef'
-d_getlogin='undef'
+d_getlogin='define'
d_getpgrp2='undef'
d_getpgrp='undef'
d_getpgid='undef'
d_setgrps='undef'
d_gethent='undef'
d_gethname='undef'
-d_getlogin='undef'
+d_getlogin='define'
d_getpgrp2='undef'
d_getpgrp='undef'
d_getpgid='undef'
* This symbol, if defined, indicates that the getlogin routine is
* available to get the login name.
*/
-/*#define HAS_GETLOGIN /**/
+#define HAS_GETLOGIN /**/
/* HAS_GETPGRP2:
* This symbol, if defined, indicates that the getpgrp2() (as in DG/UX)
* This symbol, if defined, indicates that the getlogin routine is
* available to get the login name.
*/
-/*#define HAS_GETLOGIN /**/
+#define HAS_GETLOGIN /**/
/* HAS_GETPGRP2:
* This symbol, if defined, indicates that the getpgrp2() (as in DG/UX)
* This symbol, if defined, indicates that the getlogin routine is
* available to get the login name.
*/
-/*#define HAS_GETLOGIN /**/
+#define HAS_GETLOGIN /**/
/* HAS_GETPGRP2:
* This symbol, if defined, indicates that the getpgrp2() (as in DG/UX)
#ifdef USE_THREADS
# ifdef USE_DECLSPEC_THREAD
__declspec(thread) char strerror_buffer[512];
+__declspec(thread) char getlogin_buffer[128];
# ifdef HAVE_DES_FCRYPT
__declspec(thread) char crypt_buffer[30];
# endif
# else
# define strerror_buffer (thr->i.Wstrerror_buffer)
+# define getlogin_buffer (thr->i.Wgetlogin_buffer)
# define crypt_buffer (thr->i.Wcrypt_buffer)
# endif
#else
char strerror_buffer[512];
+char getlogin_buffer[128];
# ifdef HAVE_DES_FCRYPT
char crypt_buffer[30];
# endif
return (agid == ROOT_GID ? 0 : -1);
}
+char *
+getlogin(void)
+{
+ dTHR;
+ char *buf = getlogin_buffer;
+ DWORD size = sizeof(getlogin_buffer);
+ if (GetUserName(buf,&size))
+ return buf;
+ return (char*)NULL;
+}
+
/*
* pretended kill
*/
XS(w32_LoginName)
{
dXSARGS;
- char name[256];
- DWORD size = sizeof(name);
+ char *name = getlogin_buffer;
+ DWORD size = sizeof(getlogin_buffer);
if (GetUserName(name,&size)) {
/* size includes NULL */
ST(0) = sv_2mortal(newSVpv(name,size-1));
extern int setgid(gid_t gid);
extern int kill(int pid, int sig);
extern void *sbrk(int need);
+extern char * getlogin(void);
#undef Stat
#define Stat win32_stat
*/
#ifdef USE_THREADS
-#ifndef USE_DECLSPEC_THREAD
-#define HAVE_THREAD_INTERN
-
-struct thread_intern
-{
- char Wstrerror_buffer[512];
- struct servent Wservent;
-#ifdef HAVE_DES_FCRYPT
- char Wcrypt_buffer[30];
-#endif
+# ifndef USE_DECLSPEC_THREAD
+# define HAVE_THREAD_INTERN
+
+struct thread_intern {
+ /* XXX can probably use one buffer instead of several */
+ char Wstrerror_buffer[512];
+ struct servent Wservent;
+ char Wgetlogin_buffer[128];
+# ifdef HAVE_DES_FCRYPT
+ char Wcrypt_buffer[30];
+# endif
};
-#endif
-#endif
+# endif /* !USE_DECLSPEC_THREAD */
+#endif /* USE_THREADS */
#endif /* _INC_WIN32_PERL5 */