-/*
- * security.c: Security internal calls
+/**
+ * \file
+ * Security internal calls
*
* Author:
* Sebastien Pouliot <sebastien@ximian.com>
#include <config.h>
#endif
-#include <mono/metadata/assembly.h>
+#include <mono/metadata/assembly-internals.h>
#include <mono/metadata/appdomain.h>
#include <mono/metadata/image.h>
#include <mono/metadata/exception.h>
{
gchar *uname = NULL;
+#ifdef HAVE_PWD_H
+
#ifdef HAVE_GETPWUID_R
struct passwd pwd;
size_t fbufsize;
g_free (fbuf);
#endif
+#endif /* HAVE_PWD_H */
+
return uname;
}
+#ifdef HAVE_GRP_H
+
static gboolean
IsMemberInList (uid_t user, struct group *g)
{
return result;
}
+#endif /* HAVE_GRP_H */
+
static gboolean
IsDefaultGroup (uid_t user, gid_t group)
{
+ gboolean result = FALSE;
+
+#ifdef HAVE_PWD_H
+
#ifdef HAVE_GETPWUID_R
struct passwd pwd;
size_t fbufsize;
gint32 retval;
#endif
struct passwd *p = NULL;
- gboolean result;
#ifdef HAVE_GETPWUID_R
#ifdef _SC_GETPW_R_SIZE_MAX
g_free (fbuf);
#endif
+#endif /* HAVE_PWD_H */
+
return result;
}
+#ifdef HAVE_GRP_H
+
static gboolean
IsMemberOf (gid_t user, struct group *g)
{
/* is the user in the group list */
return IsMemberInList (user, g);
}
+
+#endif /* HAVE_GRP_H */
+
#endif /* !HOST_WIN32 */
/* ICALLS */
gpointer
ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoString *username)
{
+ gpointer token = (gpointer)-2;
+
+#ifdef HAVE_PWD_H
+
#ifdef HAVE_GETPWNAM_R
struct passwd pwd;
size_t fbufsize;
gchar *fbuf;
gint32 retval;
#endif
- gpointer token = (gpointer) -2;
struct passwd *p;
gchar *utf8_name;
gboolean result;
#endif
g_free (utf8_name);
+#endif /* HAVE_PWD_H */
+
return token;
}
#endif /* HOST_WIN32 */
{
gboolean result = FALSE;
+#ifdef HAVE_GRP_H
+
#ifdef HAVE_GETGRGID_R
struct group grp;
size_t fbufsize;
g_free (fbuf);
#endif
+#endif /* HAVE_GRP_H */
+
return result;
}
ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, MonoString *group)
{
gboolean result = FALSE;
+
+#ifdef HAVE_GRP_H
+
gchar *utf8_groupname;
utf8_groupname = mono_unicode_to_external (mono_string_chars (group));
g_free (utf8_groupname);
}
+#endif /* HAVE_GRP_H */
+
return result;
}
#endif /* !HOST_WIN32 */
if (system_security_assembly == NULL) {
system_security_assembly = mono_image_loaded ("System.Security");
if (!system_security_assembly) {
- MonoAssembly *sa = mono_assembly_open ("System.Security.dll", NULL);
+ MonoAssembly *sa = mono_assembly_open_predicate ("System.Security.dll", FALSE, FALSE, NULL, NULL, NULL);
if (!sa)
g_assert_not_reached ();
system_security_assembly = mono_assembly_get_image (sa);