Remove unneeded whitespace.
* fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be set to ENXIO when opening a fifo write/nonblocking. * environ.cc (ucreqenv): Rename to ucenv. Move code from old ucenv here and conditionalize it on create_upcaseenv. (ucenv): Delete. (environ_init): Fix compiler warning by moving create_upcaseenv test to ucenv. Don't bother checking for child_proc_info when calling ucenv since it is assumed to be NULL at the point where the function is called. * path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing with devices since the device handler passes in a translated MS-DOS path. * sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which causes a compiler error. * fhandler_netdrive.cc: Update copyright.
This commit is contained in:
parent
f43f75a09d
commit
025c1fac6e
|
@ -1,3 +1,27 @@
|
||||||
|
2008-11-26 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
|
Remove unneeded whitespace.
|
||||||
|
|
||||||
|
* fhandler_fifo.cc (fhandler_fifo::open): Rework to cause errno to be
|
||||||
|
set to ENXIO when opening a fifo write/nonblocking.
|
||||||
|
|
||||||
|
* environ.cc (ucreqenv): Rename to ucenv. Move code from old ucenv
|
||||||
|
here and conditionalize it on create_upcaseenv.
|
||||||
|
(ucenv): Delete.
|
||||||
|
(environ_init): Fix compiler warning by moving create_upcaseenv test to
|
||||||
|
ucenv. Don't bother checking for child_proc_info when calling ucenv
|
||||||
|
since it is assumed to be NULL at the point where the function is
|
||||||
|
called.
|
||||||
|
|
||||||
|
* path.cc (symlink_worker): Turn off MS-DOS path warnings when dealing
|
||||||
|
with devices since the device handler passes in a translated MS-DOS
|
||||||
|
path.
|
||||||
|
|
||||||
|
* sec_auth.cc (lsaprivkeyauth): Avoid variable initialization which
|
||||||
|
causes a compiler error.
|
||||||
|
|
||||||
|
* fhandler_netdrive.cc: Update copyright.
|
||||||
|
|
||||||
2008-11-26 Corinna Vinschen <corinna@vinschen.de>
|
2008-11-26 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* Makefile.in (DLL_OFILES): Add setlsapwd.o.
|
* Makefile.in (DLL_OFILES): Add setlsapwd.o.
|
||||||
|
|
|
@ -437,23 +437,6 @@ unsetenv (const char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Turn environment variable part of a=b string into uppercase. */
|
|
||||||
static __inline__ void
|
|
||||||
ucenv (char *p, char *eq)
|
|
||||||
{
|
|
||||||
/* Amazingly, NT has a case sensitive environment name list,
|
|
||||||
but only sometimes.
|
|
||||||
It's normal to have NT set your "Path" to something.
|
|
||||||
Later, you set "PATH" to something else. This alters "Path".
|
|
||||||
But if you try and do a naive getenv on "PATH" you'll get nothing.
|
|
||||||
|
|
||||||
So we upper case the labels here to prevent confusion later but
|
|
||||||
we only do it for the first process in a session group. */
|
|
||||||
for (; p < eq; p++)
|
|
||||||
if (islower (*p))
|
|
||||||
*p = cyg_toupper (*p);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Minimal list of Windows vars which must be converted to uppercase.
|
/* Minimal list of Windows vars which must be converted to uppercase.
|
||||||
Either for POSIX compatibility of for backward compatibility with
|
Either for POSIX compatibility of for backward compatibility with
|
||||||
existing applications. */
|
existing applications. */
|
||||||
|
@ -492,11 +475,29 @@ static const char idx_arr[] = "ACHNOPSTW";
|
||||||
starts. */
|
starts. */
|
||||||
static const int start_at[] = { 0, 1, 4, 7, 8, 9, 16, 18, 22 };
|
static const int start_at[] = { 0, 1, 4, 7, 8, 9, 16, 18, 22 };
|
||||||
|
|
||||||
/* Hopefully as quick as possible. Only upcase specific set of important
|
/* Turn environment variable part of a=b string into uppercase.
|
||||||
Windows variables. */
|
Conditionally controlled by upcaseenv CYGWIN setting. */
|
||||||
static __inline__ void
|
static __inline__ void
|
||||||
ucreqenv (char *p)
|
ucenv (char *p, const char *eq)
|
||||||
{
|
{
|
||||||
|
if (create_upcaseenv)
|
||||||
|
{
|
||||||
|
/* Amazingly, NT has a case sensitive environment name list,
|
||||||
|
but only sometimes.
|
||||||
|
It's normal to have NT set your "Path" to something.
|
||||||
|
Later, you set "PATH" to something else. This alters "Path".
|
||||||
|
But if you try and do a naive getenv on "PATH" you'll get nothing.
|
||||||
|
|
||||||
|
So we upper case the labels here to prevent confusion later but
|
||||||
|
we only do it for processes that are started by non-Cygwin programs. */
|
||||||
|
for (; p < eq; p++)
|
||||||
|
if (islower (*p))
|
||||||
|
*p = cyg_toupper (*p);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Hopefully as quickly as possible - only upcase specific set of important
|
||||||
|
Windows variables. */
|
||||||
char first = cyg_toupper (*p);
|
char first = cyg_toupper (*p);
|
||||||
const char *idx = strchr (idx_arr, first);
|
const char *idx = strchr (idx_arr, first);
|
||||||
if (idx)
|
if (idx)
|
||||||
|
@ -509,6 +510,7 @@ ucreqenv (char *p)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Parse CYGWIN options */
|
/* Parse CYGWIN options */
|
||||||
|
|
||||||
|
@ -847,11 +849,7 @@ environ_init (char **envp, int envc)
|
||||||
if (*newp == '=')
|
if (*newp == '=')
|
||||||
*newp = '!';
|
*newp = '!';
|
||||||
char *eq = strechr (newp, '=');
|
char *eq = strechr (newp, '=');
|
||||||
if (!child_proc_info)
|
ucenv (newp, eq); /* (possibly conditionally) uppercase env vars. */
|
||||||
if (create_upcaseenv)
|
|
||||||
ucenv (newp, eq); /* Uppercase all env vars. */
|
|
||||||
else
|
|
||||||
ucreqenv (newp); /* Uppercase only selected vars. */
|
|
||||||
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
|
if (*newp == 'T' && strncmp (newp, "TERM=", 5) == 0)
|
||||||
sawTERM = 1;
|
sawTERM = 1;
|
||||||
if (*eq && conv_start_chars[(unsigned char) envp[i][0]])
|
if (*eq && conv_start_chars[(unsigned char) envp[i][0]])
|
||||||
|
|
|
@ -86,13 +86,26 @@ fhandler_fifo::open (int flags, mode_t)
|
||||||
LPSECURITY_ATTRIBUTES sa_buf =
|
LPSECURITY_ATTRIBUTES sa_buf =
|
||||||
sec_user ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
|
sec_user ((PSECURITY_ATTRIBUTES) char_sa_buf, cygheap->user.sid());
|
||||||
mode |= FILE_FLAG_OVERLAPPED;
|
mode |= FILE_FLAG_OVERLAPPED;
|
||||||
HANDLE h = CreateNamedPipe(npname, mode, FIFO_PIPE_MODE,
|
|
||||||
|
HANDLE h;
|
||||||
|
DWORD err;
|
||||||
|
bool nonblocking_write = !!((flags & (O_WRONLY | O_NONBLOCK)) == (O_WRONLY | O_NONBLOCK));
|
||||||
|
if (nonblocking_write)
|
||||||
|
{
|
||||||
|
h = INVALID_HANDLE_VALUE;
|
||||||
|
err = ERROR_ACCESS_DENIED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
h = CreateNamedPipe(npname, mode, FIFO_PIPE_MODE,
|
||||||
PIPE_UNLIMITED_INSTANCES, 0, 0,
|
PIPE_UNLIMITED_INSTANCES, 0, 0,
|
||||||
NMPWAIT_WAIT_FOREVER, sa_buf);
|
NMPWAIT_WAIT_FOREVER, sa_buf);
|
||||||
|
err = GetLastError ();
|
||||||
|
}
|
||||||
if (h != INVALID_HANDLE_VALUE)
|
if (h != INVALID_HANDLE_VALUE)
|
||||||
wait_state = fifo_wait_for_client;
|
wait_state = fifo_wait_for_client;
|
||||||
else
|
else
|
||||||
switch (GetLastError ())
|
switch (err)
|
||||||
{
|
{
|
||||||
case ERROR_ACCESS_DENIED:
|
case ERROR_ACCESS_DENIED:
|
||||||
h = open_nonserver (npname, low_flags, sa_buf);
|
h = open_nonserver (npname, low_flags, sa_buf);
|
||||||
|
@ -101,6 +114,11 @@ fhandler_fifo::open (int flags, mode_t)
|
||||||
wait_state = fifo_wait_for_server;
|
wait_state = fifo_wait_for_server;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (nonblocking_write && GetLastError () == ERROR_FILE_NOT_FOUND)
|
||||||
|
{
|
||||||
|
set_errno (ENXIO);
|
||||||
|
break;
|
||||||
|
}
|
||||||
/* fall through intentionally */
|
/* fall through intentionally */
|
||||||
default:
|
default:
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* fhandler_netdrive.cc: fhandler for // and //MACHINE handling
|
/* fhandler_netdrive.cc: fhandler for // and //MACHINE handling
|
||||||
|
|
||||||
Copyright 2005 Red Hat, Inc.
|
Copyright 2005, 2006, 2007, 2008 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
|
|
@ -1525,6 +1525,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
HANDLE fh;
|
HANDLE fh;
|
||||||
tmp_pathbuf tp;
|
tmp_pathbuf tp;
|
||||||
|
unsigned check_opt;
|
||||||
|
|
||||||
/* POSIX says that empty 'newpath' is invalid input while empty
|
/* POSIX says that empty 'newpath' is invalid input while empty
|
||||||
'oldpath' is valid -- it's symlink resolver job to verify if
|
'oldpath' is valid -- it's symlink resolver job to verify if
|
||||||
|
@ -1551,14 +1552,16 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
||||||
set_errno (ENOENT);
|
set_errno (ENOENT);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_opt = PC_SYM_NOFOLLOW | PC_POSIX | (isdevice ? PC_NOWARN : 0);
|
||||||
/* We need the normalized full path below. */
|
/* We need the normalized full path below. */
|
||||||
win32_newpath.check (newpath, PC_SYM_NOFOLLOW | PC_POSIX, stat_suffixes);
|
win32_newpath.check (newpath, check_opt, stat_suffixes);
|
||||||
if (use_winsym && !win32_newpath.exists ()
|
if (use_winsym && !win32_newpath.exists ()
|
||||||
&& (isdevice || !win32_newpath.fs_is_nfs ()))
|
&& (isdevice || !win32_newpath.fs_is_nfs ()))
|
||||||
{
|
{
|
||||||
char *newplnk = tp.c_get ();
|
char *newplnk = tp.c_get ();
|
||||||
stpcpy (stpcpy (newplnk, newpath), ".lnk");
|
stpcpy (stpcpy (newplnk, newpath), ".lnk");
|
||||||
win32_newpath.check (newplnk, PC_SYM_NOFOLLOW | PC_POSIX);
|
win32_newpath.check (newplnk, check_opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win32_newpath.error)
|
if (win32_newpath.error)
|
||||||
|
@ -1621,7 +1624,11 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
||||||
/* The symlink target is relative to the directory in which
|
/* The symlink target is relative to the directory in which
|
||||||
the symlink gets created, not relative to the cwd. Therefore
|
the symlink gets created, not relative to the cwd. Therefore
|
||||||
we have to mangle the path quite a bit before calling path_conv. */
|
we have to mangle the path quite a bit before calling path_conv. */
|
||||||
if (!isabspath (oldpath))
|
if (isabspath (oldpath))
|
||||||
|
win32_oldpath.check (oldpath,
|
||||||
|
PC_SYM_NOFOLLOW,
|
||||||
|
stat_suffixes);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
len = strrchr (win32_newpath.normalized_path, '/')
|
len = strrchr (win32_newpath.normalized_path, '/')
|
||||||
- win32_newpath.normalized_path + 1;
|
- win32_newpath.normalized_path + 1;
|
||||||
|
@ -1630,8 +1637,6 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym,
|
||||||
oldpath);
|
oldpath);
|
||||||
win32_oldpath.check (absoldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
win32_oldpath.check (absoldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
win32_oldpath.check (oldpath, PC_SYM_NOFOLLOW, stat_suffixes);
|
|
||||||
if (SUCCEEDED (SHGetDesktopFolder (&psl)))
|
if (SUCCEEDED (SHGetDesktopFolder (&psl)))
|
||||||
{
|
{
|
||||||
WCHAR wc_path[win32_oldpath.get_wide_win32_path_len () + 1];
|
WCHAR wc_path[win32_oldpath.get_wide_win32_path_len () + 1];
|
||||||
|
|
|
@ -1221,7 +1221,8 @@ lsaprivkeyauth (struct passwd *pw)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The key is not 0-terminated. */
|
/* The key is not 0-terminated. */
|
||||||
PWCHAR passwd = (PWCHAR) alloca (data->Length + sizeof (WCHAR));
|
PWCHAR passwd;
|
||||||
|
passwd = (PWCHAR) alloca (data->Length + sizeof (WCHAR));
|
||||||
*wcpncpy (passwd, data->Buffer, data->Length / sizeof (WCHAR)) = L'\0';
|
*wcpncpy (passwd, data->Buffer, data->Length / sizeof (WCHAR)) = L'\0';
|
||||||
LsaFreeMemory (data);
|
LsaFreeMemory (data);
|
||||||
debug_printf ("Try logon for %W\\%W", domain, user);
|
debug_printf ("Try logon for %W\\%W", domain, user);
|
||||||
|
|
Loading…
Reference in New Issue