diff options
author | William Jon McCann <mccann@jhu.edu> | 2007-10-04 22:25:28 +0000 |
---|---|---|
committer | William Jon McCann <mccann@src.gnome.org> | 2007-10-04 22:25:28 +0000 |
commit | e2bf2da75482d853c5da54e4dc6b89d0596e68fa (patch) | |
tree | 03776231997a2ef2ab8900ae922e1f6422715466 /common/gdm-common-unknown-origin.h | |
parent | 14333ef1ffc4d2c5b162d2631c52ab71d88a2641 (diff) | |
download | gdm-e2bf2da75482d853c5da54e4dc6b89d0596e68fa.tar.gz |
Remove some more obsolete code. Move common code with unknown copyright
2007-10-04 William Jon McCann <mccann@jhu.edu>
* common/Makefile.am:
* common/gdm-common-unknown-origin.c: (gdm_sigchld_block_push),
(gdm_sigchld_block_pop), (gdm_sigterm_block_push),
(gdm_sigterm_block_pop), (gdm_sigusr2_block_push),
(gdm_sigusr2_block_pop), (gdm_safe_fopen_w), (ve_clearenv):
* common/gdm-common-unknown-origin.h:
* common/gdm-common.c:
* common/gdm-common.h:
* config/Makefile.am:
* config/XKeepsCrashing:
* config/default.desktop.in:
* config/extract-shell.sh:
* config/gdmprefetchlist.in:
* config/gettextfoo.h:
* config/locale.alias:
* config/ssh.desktop.in.in:
* configure.ac:
* daemon/Makefile.am:
* daemon/choose.c:
* daemon/choose.h:
* daemon/gdm-xdmcp-display-factory.c:
(gdm_xdmcp_handle_indirect_query), (gdm_xdmcp_handle_manage),
(gdm_xdmcp_handle_managed_forward):
* daemon/main.c: (delete_pid):
* utils/Makefile.am:
* utils/gdm-dmx-reconnect-proxy.c:
Remove some more obsolete code. Move common
code with unknown copyright status into separate file.
Try to identify more copy with unknown copyright status.
svn path=/branches/mccann-gobject/; revision=5340
Diffstat (limited to 'common/gdm-common-unknown-origin.h')
-rw-r--r-- | common/gdm-common-unknown-origin.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/common/gdm-common-unknown-origin.h b/common/gdm-common-unknown-origin.h new file mode 100644 index 00000000..33c1d060 --- /dev/null +++ b/common/gdm-common-unknown-origin.h @@ -0,0 +1,87 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * (c) 2000 Eazel, Inc. + * (c) 2001,2002 George Lebl + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _GDM_COMMON_UNKNOWN_H +#define _GDM_COMMON_UNKNOWN_H + +#include <glib.h> +#include <glib/gstdio.h> +#include <time.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/wait.h> + +G_BEGIN_DECLS + +#define VE_IGNORE_EINTR(expr) \ + do { \ + errno = 0; \ + expr; \ + } while G_UNLIKELY (errno == EINTR); + +#define NEVER_FAILS_seteuid(uid) \ + { int r = 0; \ + if (geteuid () != uid) \ + r = seteuid (uid); \ + if G_UNLIKELY (r != 0) \ + g_error ("GDM file %s: line %d (%s): Cannot run seteuid to %d: %s", \ + __FILE__, \ + __LINE__, \ + G_GNUC_PRETTY_FUNCTION, \ + (int)uid, \ + strerror (errno)); } +#define NEVER_FAILS_setegid(gid) \ + { int r = 0; \ + if (getegid () != gid) \ + r = setegid (gid); \ + if G_UNLIKELY (r != 0) \ + g_error ("GDM file %s: line %d (%s): Cannot run setegid to %d: %s", \ + __FILE__, \ + __LINE__, \ + G_GNUC_PRETTY_FUNCTION, \ + (int)gid, \ + strerror (errno)); } + +/* first goes to euid-root and then sets the egid and euid, to make sure + * this succeeds */ +#define NEVER_FAILS_root_set_euid_egid(uid,gid) \ + { NEVER_FAILS_seteuid (0); \ + NEVER_FAILS_setegid (gid); \ + if (uid != 0) { NEVER_FAILS_seteuid (uid); } } + + +/* like fopen with "w" but unlinks and uses O_EXCL */ +FILE * gdm_safe_fopen_w (const char *file, + mode_t perm); + +/* This is for race free forks */ +void gdm_sigchld_block_push (void); +void gdm_sigchld_block_pop (void); +void gdm_sigterm_block_push (void); +void gdm_sigterm_block_pop (void); +void gdm_sigusr2_block_push (void); +void gdm_sigusr2_block_pop (void); + +void ve_clearenv (void); + +G_END_DECLS + +#endif /* _GDM_COMMON_UNKNOWN_H */ |