Enlightenment CVS committal

Author  : raster
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_desklock.c e_desklock.h 


Log Message:


and general code formatting, layout, organisation and namespacing - be mroe
consistent.

===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_desklock.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- e_desklock.c        18 Apr 2006 03:08:43 -0000      1.12
+++ e_desklock.c        18 Apr 2006 03:14:29 -0000      1.13
@@ -1,5 +1,4 @@
 #include "e.h"
-
 #ifdef HAVE_PAM
 # include <security/pam_appl.h>
 # include <pwd.h>
@@ -9,34 +8,12 @@
 #define ELOCK_POPUP_LAYER 10000
 #define PASSWD_LEN 256
 
-/**************************** Pam support *******************************/
-
-#ifdef HAVE_PAM
-struct _Desklock_Auth
-{
-   struct {
-      struct pam_conv conv;
-      pam_handle_t    *handle;
-   } pam;
-   
-   char user[PATH_MAX];
-   char passwd[PATH_MAX];
-};
-
-static int _e_desklock_cb_exit(void *data, int type, void *event);
-static int _desklock_auth(const char *passwd);
-static int _desklock_pam_init(struct _Desklock_Auth *da);
-static int _desklock_auth_pam_conv(int num_msg, const struct pam_message 
**msg, struct pam_response **resp, void *appdata_ptr);
-static char *_desklock_auth_get_current_user(void);
-static char *_desklock_auth_get_current_host(void);
-
-static Ecore_Event_Handler *_e_desklock_exit_handler = NULL;
-static pid_t _e_desklock_child_pid = -1;
-#endif
-
 /**************************** private data ******************************/
 typedef struct _E_Desklock_Data                E_Desklock_Data;
 typedef struct _E_Desklock_Popup_Data  E_Desklock_Popup_Data;
+#ifdef HAVE_PAM
+typedef struct _E_Desklock_Auth         E_Desklock_Auth;
+#endif
 
 struct _E_Desklock_Popup_Data
 {
@@ -53,9 +30,25 @@
    Ecore_X_Window  elock_grab_break_wnd;
    char                  passwd[PASSWD_LEN];
 };
+#ifdef HAVE_PAM
+struct _E_Desklock_Auth
+{
+   struct {
+      struct pam_conv conv;
+      pam_handle_t    *handle;
+   } pam;
+   
+   char user[PATH_MAX];
+   char passwd[PATH_MAX];
+};
+#endif
 
-static E_Desklock_Data *edd = NULL;
-static E_Zone          *last_active_zone = NULL;
+static E_Desklock_Data    *edd = NULL;
+static E_Zone             *last_active_zone = NULL;
+#ifdef HAVE_PAM
+static Ecore_Event_Handler *_e_desklock_exit_handler = NULL;
+static pid_t                _e_desklock_child_pid = -1;
+#endif
 
 /***********************************************************************/
 
@@ -72,6 +65,35 @@
 
 static int _e_desklock_check_auth();
 
+#ifdef HAVE_PAM
+static int _e_desklock_cb_exit(void *data, int type, void *event);
+static int _desklock_auth(const char *passwd);
+static int _desklock_pam_init(E_Desklock_Auth *da);
+static int _desklock_auth_pam_conv(int num_msg, const struct pam_message 
**msg, struct pam_response **resp, void *appdata_ptr);
+static char *_desklock_auth_get_current_user(void);
+static char *_desklock_auth_get_current_host(void);
+#endif
+
+EAPI int
+e_desklock_init(void)
+{
+   if (e_config->desklock_disable_screensaver)
+     ecore_x_screensaver_timeout_set(0);
+   else
+     {
+       if (e_config->desklock_use_timeout)
+         ecore_x_screensaver_timeout_set(e_config->desklock_timeout);
+     }
+   return 1;
+}
+
+EAPI int
+e_desklock_shutdown(void)
+{
+   e_desklock_hide();
+   return 1;
+}
+
 EAPI int
 e_desklock_show(void)
 {
@@ -408,26 +430,6 @@
    return 1;
 }
 
-EAPI int
-e_desklock_init(void)
-{
-   if (e_config->desklock_disable_screensaver)
-     ecore_x_screensaver_timeout_set(0);
-   else
-     {
-       if (e_config->desklock_use_timeout)
-         ecore_x_screensaver_timeout_set(e_config->desklock_timeout);
-     }
-   return 1;
-}
-
-EAPI int
-e_desklock_shutdown(void)
-{
-   e_desklock_hide();
-   return 1;
-}
-
 static void
 _e_desklock_passwd_update()
 {
@@ -507,12 +509,13 @@
      return _desklock_auth(edd->passwd);
    else if (e_config->desklock_auth_method == 1)
      {
-#endif // HAVE_PAM
+#endif
        if ((e_config->desklock_personal_passwd) &&
            (!strcmp(edd->passwd == NULL ? "" : edd->passwd,
                     e_config->desklock_personal_passwd == NULL ? "" :
                     e_config->desklock_personal_passwd)))
          {
+            /* password ok */
             memset(edd->passwd, 0, sizeof(char) * PASSWD_LEN);
             e_desklock_hide();
             return 1;
@@ -579,7 +582,7 @@
      {
        /* child */
        int pamerr;
-       struct _Desklock_Auth da;
+       E_Desklock_Auth da;
        
        strncpy(da.user, _desklock_auth_get_current_user(), PATH_MAX);
        strncpy(da.passwd, passwd, PATH_MAX);
@@ -609,7 +612,7 @@
 }
 
 static int
-_desklock_pam_init(struct _Desklock_Auth *da)
+_desklock_pam_init(E_Desklock_Auth *da)
 {
    int pamerr;
    
@@ -638,7 +641,7 @@
 _desklock_auth_pam_conv(int num_msg, const struct pam_message **msg, struct 
pam_response **resp, void *appdata_ptr)
 {
    int replies = 0;
-   struct _Desklock_Auth *da = (struct _Desklock_Auth *)appdata_ptr;
+   E_Desklock_Auth *da = (E_Desklock_Auth *)appdata_ptr;
    struct pam_response *reply = NULL;
    
    reply = (struct pam_response *)malloc(sizeof(struct pam_response) *num_msg);
===================================================================
RCS file: /cvs/e/e17/apps/e/src/bin/e_desklock.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- e_desklock.h        2 Mar 2006 12:03:48 -0000       1.2
+++ e_desklock.h        18 Apr 2006 03:14:29 -0000      1.3
@@ -1,4 +1,3 @@
-
 #ifdef E_TYPEDEFS
 #else
 #ifndef E_DESKLOCK_H




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to