SHARE
TWEET

xdm greeter.h

ananas Dec 22nd, 2012 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef __GREET_H__
  2. #define __GREET_H__
  3.  
  4. #include <X11/Xos.h>
  5. #include <X11/Xfuncs.h>
  6. #include <X11/Xfuncproto.h>
  7. #include <X11/Xmd.h>
  8. #include <X11/Xauth.h>
  9. #include <X11/Intrinsic.h>
  10. #include <X11/Xdmcp.h>
  11.  
  12. #include <gtk/gtk.h>
  13. #include <gdk/gdkx.h>
  14.  
  15. #define SYSCONFDIR  "/etc/X11"
  16. #define SESSIONDIR  "/usr/share/xsessions"
  17. #define WPDIR       "/usr/share/pixmaps"
  18.  
  19. #define MIN_UID 100
  20.  
  21. #define BORDERS 5
  22.  
  23. #define WELCOME "<span font_desc=\"Sans Bold Italic 24\" foreground=\"blue\">Welcome to %s</span>"
  24.  
  25. #define USERLABEL   "<i>Username:</i>"
  26. #define PASSLABEL   "<i>Password:</i>"
  27. #define SESSLABEL   "<i>Session:</i>"
  28.  
  29. #define REBOOT_CMD     "/sbin/reboot"
  30. #define POWEROFF_CMD   "/sbin/poweroff"
  31. #define SUSPEND_CMD    "echo mem > /sys/power/state"
  32. #define HIBERNATE_CMD  "echo disk > /sys/power/state"
  33.  
  34. #define DEFAULT_PATH   "/bin:/usr/bin:/usr/local/bin:/opt/bin:/sbin:/usr/sbin"
  35.  
  36. typedef struct {
  37.   gint min_uid;
  38.   gboolean auto_login;
  39.   gchar *auto_user;
  40.   gboolean allow_root;
  41.   gchar *welcome;
  42.   gchar *background;
  43.   gchar *theme;
  44.   gchar *user_lbl;
  45.   gchar *pwd_lbl;
  46.   gchar *sess_lbl;
  47.   gchar *session;
  48.   gchar *path;
  49.   gint borders;
  50.   gchar *reboot_cmd;
  51.   gchar *poweroff_cmd;
  52.   gchar *suspend_cmd;
  53.   gchar *hibernate_cmd;
  54. } ConfigData;
  55.  
  56. /*** xdm definitions ***/
  57.  
  58. typedef struct displayType {
  59.   unsigned int    location:1;
  60.   unsigned int    lifetime:1;
  61.   unsigned int    origin:1;
  62. } DisplayType;
  63.  
  64. #define Local          1  /* server runs on local host */
  65. #define Foreign        0  /* server runs on remote host */
  66.  
  67. #define Permanent      1  /* session restarted when it exits */
  68. #define Transient      0  /* session not restarted when it exits */
  69.  
  70. #define FromFile       1  /* started via entry in servers file */
  71. #define FromXDMCP      0  /* started with XDMCP */
  72.  
  73. typedef enum displayStatus {
  74.   running,
  75.   notRunning,
  76.   zombie,
  77.   phoenix
  78. } DisplayStatus;
  79.  
  80. typedef enum fileState {
  81.   NewEntry,
  82.   OldEntry,
  83.   MissingEntry
  84. } FileState;
  85.  
  86. struct display {
  87.   struct display  *next;
  88.   /* Xservers file / XDMCP information */
  89.   char            *name;          /* DISPLAY name */
  90.   char            *class;         /* display class (may be NULL) */
  91.   DisplayType     displayType;    /* method to handle with */
  92.   char            **argv;         /* program name and arguments */
  93.   /* display state */
  94.   DisplayStatus   status;         /* current status */
  95.   pid_t           pid;            /* process id of child */
  96.   pid_t           serverPid;      /* process id of server (-1 if none) */
  97.   FileState       state;          /* state during HUP processing */
  98.   int             startTries;     /* current start try */
  99.   time_t          lastReserv;     /* time of last reserver crash */
  100.   int             reservTries;    /* current reserver try */
  101.   /* XDMCP state */
  102.   CARD32          sessionID;      /* ID of active session */
  103.   XdmcpNetaddr    peer;           /* display peer address */
  104.   int             peerlen;        /* length of peer address */
  105.   XdmcpNetaddr    from;           /* XDMCP port of display */
  106.   int             fromlen;
  107.   CARD16          displayNumber;
  108.   int             useChooser;     /* Run the chooser for this display */
  109.   ARRAY8          clientAddr;     /* for chooser picking */
  110.   CARD16          connectionType; /* ... */
  111.   int             xdmcpFd;
  112.   /* server management resources */
  113.   int             serverAttempts; /* number of attempts at running X */
  114.   int             openDelay;      /* open delay time */
  115.   int             openRepeat;     /* open attempts to make */
  116.   int             openTimeout;    /* abort open attempt timeout */
  117.   int             startAttempts;  /* number of attempts at starting */
  118.   int             reservAttempts; /* allowed start-IO error sequences */
  119.   int             pingInterval;   /* interval between XSync */
  120.   int             pingTimeout;    /* timeout for XSync */
  121.   int             terminateServer;/* restart for each session */
  122.   int             grabServer;     /* keep server grabbed for Login */
  123.   int             grabTimeout;    /* time to wait for grab */
  124.   int             resetSignal;    /* signal to reset server */
  125.   int             termSignal;     /* signal to terminate server */
  126.   int             resetForAuth;   /* server reads auth file at reset */
  127.   char            *keymaps;       /* binary compat with DEC */
  128.   char            *greeterLib;    /* greeter shared library name */
  129.   /* session resources */
  130.   char            *resources;     /* resource file */
  131.   char            *xrdb;          /* xrdb program */
  132.   char            *setup;         /* Xsetup program */
  133.   char            *startup;       /* Xstartup program */
  134.   char            *reset;         /* Xreset program */
  135.   char            *session;       /* Xsession program */
  136.   char            *userPath;      /* path set for session */
  137.   char            *systemPath;    /* path set for startup/reset */
  138.   char            *systemShell;   /* interpreter for startup/reset */
  139.   char            *failsafeClient;/* a client to start when the session fails */
  140.   char            *chooser;       /* chooser program */
  141.   /* authorization resources */
  142.   int             authorize;      /* enable authorization */
  143.   char            **authNames;    /* authorization protocol names */
  144.   unsigned short  *authNameLens;  /* authorization protocol name lens */
  145.   char            *clientAuthFile;/* client specified auth file */
  146.   char            *userAuthDir;   /* backup directory for tickets */
  147.   int             authComplain;   /* complain when no auth for XDMCP */
  148.   /* information potentially derived from resources */
  149.   int             authNameNum;    /* number of protocol names */
  150.   Xauth           **authorizations;/* authorization data */
  151.   int             authNum;        /* number of authorizations */
  152.   char            *authFile;      /* file to store authorization in */
  153.  
  154.   int             version;        /* to keep dynamic greeter clued in */
  155.   /* add new fields only after here.  And preferably at the end. */
  156.  
  157.   /* Hack for making "Willing to manage" configurable */
  158.   char            *willing;       /* "Willing to manage" program */
  159.   Display         *dpy;           /* Display */
  160.   char            *windowPath;    /* path to server "window" */
  161. };
  162.  
  163. struct dlfuncs {
  164.   int (*_PingServer)(struct display *d, Display *alternateDpy);
  165.   void (*_SessionPingFailed)(struct display *d);
  166.   void (*_Debug)(const char * fmt, ...);
  167.   void (*_RegisterCloseOnFork)(int fd);
  168.   void (*_SecureDisplay)(struct display *d, Display *dpy);
  169.   void (*_UnsecureDisplay)(struct display *d, Display *dpy);
  170.   void (*_ClearCloseOnFork)(int fd);
  171.   void (*_SetupDisplay)(struct display *d);
  172.   void (*_LogError)(const char * fmt, ...);
  173.   void (*_SessionExit)(struct display *d, int status, int removeAuth);
  174.   void (*_DeleteXloginResources)(struct display *d, Display *dpy);
  175.   int (*_source)(char **environ, char *file);
  176.   char **(*_defaultEnv)(void);
  177.   char **(*_setEnv)(char **e, char *name, char *value);
  178.   char **(*_putEnv)(const char *string, char **env);
  179.   char **(*_parseArgs)(char **argv, char *string);
  180.   void (*_printEnv)(char **e);
  181.   char **(*_systemEnv)(struct display *d, char *user, char *home);
  182.   void (*_LogOutOfMem)(const char * fmt, ...);
  183.   void (*_setgrent)(void);              /* no longer used */
  184.   struct group *(*_getgrent)(void);     /* no longer used */
  185.   void (*_endgrent)(void);              /* no longer used */
  186.   struct spwd *(*_getspnam)(const char *);
  187.   void (*_endspent)(void);
  188.   struct passwd *(*_getpwnam)(const char *);
  189.   void (*_endpwent)(void);
  190.   char *(*_crypt)(const char *, const char *);
  191. #ifdef USE_PAM
  192.   pam_handle_t **(*_thepamhp)(void);
  193. #endif
  194. };
  195.  
  196. typedef enum {
  197.   Greet_Session_Over = 0,       /* session managed and over */
  198.   Greet_Success = 1,            /* greet succeeded, session not managed */
  199.   Greet_Failure = -1            /* greet failed */
  200. } greet_user_rtn;
  201.  
  202. struct greet_info {
  203.   char            *name;          /* user name */
  204.   char            *password;      /* user password */
  205.   char            *string;        /* random string */
  206.   char            *passwd;        /* binary compat with DEC */
  207.   int             version;        /* for dynamic greeter to see */
  208.   /* add new fields below this line, and preferably at the end */
  209.   Boolean         allow_null_passwd; /* allow null password on login */
  210.   Boolean         allow_root_login; /* allow direct root login */
  211. };
  212.  
  213. struct verify_info {
  214.   int             uid;            /* user id */
  215.   int             gid;            /* group id */
  216.   char            **argv;         /* arguments to session */
  217.   char            **userEnviron;  /* environment for session */
  218.   char            **systemEnviron;/* environment for startup/reset */
  219.   int             version;        /* for dynamic greeter to see */
  220.   /* add new fields below this line, and preferably at the end */
  221. };
  222.  
  223. /*
  224.  * Force the shared library to call through the function pointer
  225.  * initialized during the initial call into the library.
  226.  */
  227.  
  228. #define PingServer              (*__xdm_PingServer)
  229. #define SessionPingFailed       (*__xdm_SessionPingFailed)
  230. #define Debug                   (*__xdm_Debug)
  231. #define RegisterCloseOnFork     (*__xdm_RegisterCloseOnFork)
  232. #define SecureDisplay           (*__xdm_SecureDisplay)
  233. #define UnsecureDisplay         (*__xdm_UnsecureDisplay)
  234. #define ClearCloseOnFork        (*__xdm_ClearCloseOnFork)
  235. #define SetupDisplay            (*__xdm_SetupDisplay)
  236. #define LogError                (*__xdm_LogError)
  237. #define SessionExit             (*__xdm_SessionExit)
  238. #define DeleteXloginResources   (*__xdm_DeleteXloginResources)
  239. #define source                  (*__xdm_source)
  240. #define defaultEnv              (*__xdm_defaultEnv)
  241. #define setEnv                  (*__xdm_setEnv)
  242. #define putEnv                  (*__xdm_putEnv)
  243. #define parseArgs               (*__xdm_parseArgs)
  244. #define printEnv                (*__xdm_printEnv)
  245. #define systemEnv               (*__xdm_systemEnv)
  246. #define LogOutOfMem             (*__xdm_LogOutOfMem)
  247. #define setgrent                (*__xdm_setgrent)
  248. #define getgrent                (*__xdm_getgrent)
  249. #define endgrent                (*__xdm_endgrent)
  250. #define getspnam                (*__xdm_getspnam)
  251. #define endspent                (*__xdm_endspent)
  252. #define getpwnam                (*__xdm_getpwnam)
  253. #define endpwent                (*__xdm_endpwent)
  254. #define crypt                   (*__xdm_crypt)
  255. #ifdef USE_PAM
  256. # define thepamhp               (*__xdm_thepamhp)
  257. #endif
  258.  
  259. #endif /* __GREET_H__ */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top