[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111035: Fix bug #12621 with crash
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111035: Fix bug #12621 with crashes on MS-Windows in LookupAccountSid. |
Date: |
Fri, 14 Dec 2012 11:09:36 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111035
fixes bug: http://debbugs.gnu.org/12621
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Fri 2012-12-14 11:09:36 +0200
message:
Fix bug #12621 with crashes on MS-Windows in LookupAccountSid.
src/w32.c (get_name_and_id): Always pass NULL as the first argument
of lookup_account_sid. Avoids crashes with UNC file names that
refer to DFS domains, not to specific machine names. (Bug#12621)
Remove now unused argument FNAME; all callers changed.
(get_file_owner_and_group): Remove now unused argument FNAME; all
callers changed.
modified:
src/ChangeLog
src/w32.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-12-11 15:30:45 +0000
+++ b/src/ChangeLog 2012-12-14 09:09:36 +0000
@@ -1,3 +1,12 @@
+2012-12-14 Eli Zaretskii <address@hidden>
+
+ * w32.c (get_name_and_id): Always pass NULL as the first argument
+ of lookup_account_sid. Avoids crashes with UNC file names that
+ refer to DFS domains, not to specific machine names. (Bug#12621)
+ Remove now unused argument FNAME; all callers changed.
+ (get_file_owner_and_group): Remove now unused argument FNAME; all
+ callers changed.
+
2012-12-11 Eli Zaretskii <address@hidden>
* search.c (search_buffer): Check the inverse translations of each
=== modified file 'src/w32.c'
--- a/src/w32.c 2012-12-08 12:06:46 +0000
+++ b/src/w32.c 2012-12-14 09:09:36 +0000
@@ -3362,8 +3362,7 @@
#define GID 2
static int
-get_name_and_id (PSECURITY_DESCRIPTOR psd, const char *fname,
- unsigned *id, char *nm, int what)
+get_name_and_id (PSECURITY_DESCRIPTOR psd, unsigned *id, char *nm, int what)
{
PSID sid = NULL;
char machine[MAX_COMPUTERNAME_LENGTH+1];
@@ -3373,7 +3372,6 @@
DWORD name_len = sizeof (name);
char domain[1024];
DWORD domain_len = sizeof (domain);
- char *mp = NULL;
int use_dflt = 0;
int result;
@@ -3388,22 +3386,7 @@
use_dflt = 1;
else if (!w32_cached_id (sid, id, nm))
{
- /* If FNAME is a UNC, we need to lookup account on the
- specified machine. */
- if (IS_DIRECTORY_SEP (fname[0]) && IS_DIRECTORY_SEP (fname[1])
- && fname[2] != '\0')
- {
- const char *s;
- char *p;
-
- for (s = fname + 2, p = machine;
- *s && !IS_DIRECTORY_SEP (*s); s++, p++)
- *p = *s;
- *p = '\0';
- mp = machine;
- }
-
- if (!lookup_account_sid (mp, sid, name, &name_len,
+ if (!lookup_account_sid (NULL, sid, name, &name_len,
domain, &domain_len, &ignore)
|| name_len > UNLEN+1)
use_dflt = 1;
@@ -3418,9 +3401,7 @@
}
static void
-get_file_owner_and_group (PSECURITY_DESCRIPTOR psd,
- const char *fname,
- struct stat *st)
+get_file_owner_and_group (PSECURITY_DESCRIPTOR psd, struct stat *st)
{
int dflt_usr = 0, dflt_grp = 0;
@@ -3431,9 +3412,9 @@
}
else
{
- if (get_name_and_id (psd, fname, &st->st_uid, st->st_uname, UID))
+ if (get_name_and_id (psd, &st->st_uid, st->st_uname, UID))
dflt_usr = 1;
- if (get_name_and_id (psd, fname, &st->st_gid, st->st_gname, GID))
+ if (get_name_and_id (psd, &st->st_gid, st->st_gname, GID))
dflt_grp = 1;
}
/* Consider files to belong to current user/group, if we cannot get
@@ -3655,19 +3636,19 @@
psd = get_file_security_desc_by_handle (fh);
if (psd)
{
- get_file_owner_and_group (psd, name, buf);
+ get_file_owner_and_group (psd, buf);
LocalFree (psd);
}
else if (is_windows_9x () == TRUE)
- get_file_owner_and_group (NULL, name, buf);
+ get_file_owner_and_group (NULL, buf);
else if (!(is_a_symlink && follow_symlinks))
{
psd = get_file_security_desc_by_name (name);
- get_file_owner_and_group (psd, name, buf);
+ get_file_owner_and_group (psd, buf);
xfree (psd);
}
else
- get_file_owner_and_group (NULL, name, buf);
+ get_file_owner_and_group (NULL, buf);
CloseHandle (fh);
}
else
@@ -3775,7 +3756,7 @@
else
buf->st_mode = S_IFREG;
- get_file_owner_and_group (NULL, name, buf);
+ get_file_owner_and_group (NULL, buf);
}
#if 0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111035: Fix bug #12621 with crashes on MS-Windows in LookupAccountSid.,
Eli Zaretskii <=