Enlightenment CVS committal
Author : mekius
Project : e17
Module : proto
Dir : e17/proto/empower/src/bin/ewl
Modified Files:
Empower.h empower.c empower_cb_ewl.c
Log Message:
Fixed disabled window when an empty password was submitted.
Added ssh-askpass support. For now the -p option can be passed to make empower
act as ssh-askpass. Soon a busybox style symlink will be created called
empower-askpass which will also start empower in ssh-askpass mode. This mode
can also be useful for script writers who need to grab passwords. The password
is just written to stdout while in this mode.
===================================================================
RCS file: /cvs/e/e17/proto/empower/src/bin/ewl/Empower.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- Empower.h 30 May 2007 03:30:31 -0000 1.8
+++ Empower.h 30 May 2007 17:51:36 -0000 1.9
@@ -18,6 +18,8 @@
char cmd[1024];
Ecore_Exe *sudo;
+enum{SUDO,PASS} mode;
+
/* empower_cb prototypes */
void key_down_cb(Ewl_Widget *w, void *event, void *data);
void destroy_cb(Ewl_Widget *w, void *event, void *data);
===================================================================
RCS file: /cvs/e/e17/proto/empower/src/bin/ewl/empower.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- empower.c 30 May 2007 03:30:31 -0000 1.4
+++ empower.c 30 May 2007 17:51:36 -0000 1.5
@@ -2,30 +2,45 @@
int main(int argc, char** argv)
{
- --argc; ++argv; //pop off program name
sudo = NULL;
+ if(!strcmp(*argv,"empower-askpass"))
+ mode = PASS;
+ else if(!strcmp(*argv, "./empower-askpass"))
+ mode = PASS;
+ else
+ mode = SUDO;
+
+ --argc; ++argv; //pop off program name
+
+ if(mode != PASS && !strcmp(*argv, "-p"))
+ mode = PASS;
+
if(!ecore_init())
{
printf("Unable to init ecore\n");
return 1;
}
- if(argc) //commands
+ if(argc || mode == PASS) //commands
{
int i;
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT,exit_cb,NULL);
- snprintf(cmd, 1024, "sudo");
+ if(mode == SUDO)
+ snprintf(cmd, 1024, "sudo");
while(argc)
{
- if(strcmp(*argv, "--")) //-- is used to stop
sudo options, lets use that
+ if(strcmp(*argv, "--"))
{
- strncat(cmd, " ", 1024);
- strncat(cmd, *argv, 1024);
- --argc; ++argv; //pop these options off
so ewl just gets its options
+ if(mode == SUDO)
+ {
+ strncat(cmd, " ", 1024);
+ strncat(cmd, *argv, 1024);
+ --argc; ++argv;
+ }
}
else
break;
@@ -37,15 +52,21 @@
return;
}
- ecore_job_add(check_sudo_timeout_job, NULL);
+ if(mode == SUDO)
+ ecore_job_add(check_sudo_timeout_job, NULL);
+ else if(mode == PASS)
+ display_window();
ewl_main();
- ecore_exe_run(cmd,NULL);
+ if(mode == SUDO)
+ ecore_exe_run(cmd,NULL);
}
else
{
- printf("Usage: ./empower [SUDO OPTIONS] <program name> [PROGRAM
OPTIONS] -- [EWL OPTIONS]\n");
+ printf("-=Usage=-\n");
+ printf(" Sudo: empower [SUDO OPTIONS] <program> [PROGRAM
OPTIONS] -- [EWL OPTIONS]\n");
+ printf(" AskPass: empower-askpass -- [EWL OPTIONS] or
empower -p -- [EWL OPTIONS]\n");
return 1;
}
===================================================================
RCS file: /cvs/e/e17/proto/empower/src/bin/ewl/empower_cb_ewl.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- empower_cb_ewl.c 30 May 2007 03:30:31 -0000 1.6
+++ empower_cb_ewl.c 30 May 2007 17:51:36 -0000 1.7
@@ -34,8 +34,18 @@
{
char *pass = ewl_password_text_get(EWL_PASSWORD(data));
- authorize(pass);
- ewl_widget_disable(win);
+ if(pass && strlen(pass))
+ {
+ ewl_widget_disable(win);
+
+ if(mode == SUDO)
+ authorize(pass);
+ else
+ {
+ printf("%s",pass);
+ ewl_main_quit();
+ }
+ }
}
int sudo_done_cb(void *data, int type, void *event)
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs