Discussion:
mgetty: automatically sending to app w/o login
(too old to reply)
Scott Markwell
2005-11-22 00:44:19 UTC
Permalink
I am wondering if there is a setting I am seeing that allows for
mgetty to skip the login.config check and launch a separate program
automatically after picking up the line.
The box does not need this step as every login attempt goes to the
same program, and is tightly constrained.

--
Scott Markwell
Gert Doering
2005-11-23 14:55:22 UTC
Permalink
Hi,
Post by Scott Markwell
I am wondering if there is a setting I am seeing that allows for
mgetty to skip the login.config check and launch a separate program
automatically after picking up the line.
The box does not need this step as every login attempt goes to the
same program, and is tightly constrained.
#define ENV_TTYPROMPT in policy.h and recompile.

There currently is no run-time switch for this.

gert
--
Gert Doering
Mobile communications ... right now writing from * KL866 Seoul -> Amsterdam *

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Scott Markwell
2005-11-23 20:26:11 UTC
Permalink
Thanks
Post by Gert Doering
Hi,
Post by Scott Markwell
I am wondering if there is a setting I am seeing that allows for
mgetty to skip the login.config check and launch a separate program
automatically after picking up the line.
The box does not need this step as every login attempt goes to the
same program, and is tightly constrained.
#define ENV_TTYPROMPT in policy.h and recompile.
There currently is no run-time switch for this.
gert
--
Gert Doering
Mobile communications ... right now writing from * KL866 Seoul -> Amsterdam *
--
Scott Markwell

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Scott Markwell
2005-11-23 23:28:35 UTC
Permalink
I'd like to request that this functionality be added to a future
build, to be configurable at runtime. The issue being is patch
management, where applying a patch across multiple systems remotely
isn't easy under SUSE to do if the patches must be deployed as source
packages.
Post by Scott Markwell
Thanks
Post by Gert Doering
Hi,
Post by Scott Markwell
I am wondering if there is a setting I am seeing that allows for
mgetty to skip the login.config check and launch a separate program
automatically after picking up the line.
The box does not need this step as every login attempt goes to the
same program, and is tightly constrained.
#define ENV_TTYPROMPT in policy.h and recompile.
There currently is no run-time switch for this.
gert
--
Gert Doering
Mobile communications ... right now writing from * KL866 Seoul -> Amsterdam *
--
Scott Markwell
--
Scott Markwell

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Gert Doering
2005-11-24 13:24:53 UTC
Permalink
Hi,
Post by Scott Markwell
I'd like to request that this functionality be added to a future
build, to be configurable at runtime. The issue being is patch
management, where applying a patch across multiple systems remotely
isn't easy under SUSE to do if the patches must be deployed as source
packages.
It's on my TODO list, but I'm not promising any delivery date...

gert
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany ***@greenie.muc.de
fax: +49-89-35655025 ***@net.informatik.tu-muenchen.de

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Gert Doering
2005-11-24 17:00:48 UTC
Permalink
Hi,
Post by Scott Markwell
I'd like to request that this functionality be added to a future
build, to be configurable at runtime. The issue being is patch
management, where applying a patch across multiple systems remotely
isn't easy under SUSE to do if the patches must be deployed as source
packages.
ok, here we go. You asked for it, you test it :-)

The patch below is against "pristine" 1.1.33, and adds the run-time
option "login-env-ttyprompt-hack yes/no" (default=no) to mgetty.config.

All I can say is "it compiles, and the code looks good", but I have
NOT tested it.

I'd appreciate if you could do a quick test on both variants, and tell
me if it works.

gert
------------- snip --------------
Index: logname.c
===================================================================
RCS file: /u2/cvs/mgetty/logname.c,v
retrieving revision 4.9
retrieving revision 4.11
diff -u -r4.9 -r4.11
--- logname.c 17 Aug 2003 10:38:36 -0000 4.9
+++ logname.c 24 Nov 2005 16:58:32 -0000 4.11
@@ -1,10 +1,20 @@
-#ident "$Id: logname.c,v 4.9 2003/08/17 10:38:36 gert Exp $ Copyright (c) Gert Doering"
+#ident "$Id: logname.c,v 4.11 2005/11/24 16:58:32 gert Exp $ Copyright (c) Gert Doering"

/* logname.c
*
* print 'login:' prompt, handling eventual escape sequence substitutions
*
* read login name, detect incoming PPP frames and FIDO startup sequences
+ *
+ * $Log: logname.c,v $
+ * Revision 4.11 2005/11/24 16:58:32 gert
+ * add extra flag, env_ttyprompt, that replaces #ifdef ENV_TTYPROMPT
+ *
+ * Revision 4.10 2005/04/25 21:09:13 gert
+ * drain tty output before changing CR/LF settings after reading login name
+ * (this was a race condition on very fast machines that lead to confused
+ * tty drivers - and there is no good reason NOT to let the output drain)
+ *
*/


@@ -257,9 +267,11 @@
* If ENV_TTYPROMPT is set, do not read anything
*/

-int getlogname _P6( (prompt, tio, buf, maxsize, max_login_time, do_fido),
+int getlogname _P7( (prompt, tio, buf, maxsize, max_login_time,
+ do_fido, env_ttyprompt),
char * prompt, TIO * tio, char * buf,
- int maxsize, int max_login_time, boolean do_fido )
+ int maxsize, int max_login_time,
+ boolean do_fido, boolean env_ttyprompt )
{
int i, r;
char ch;
@@ -278,15 +290,16 @@

final_prompt = ln_escape_prompt( prompt );

-#ifdef ENV_TTYPROMPT
- printf( "\r\n%s", final_prompt );
- tio_mode_sane( tio, FALSE );
- tio_map_cr( tio, TRUE );
- tio_set( STDIN, tio );
- buf[0] = 0;
- set_env_var( "TTYPROMPT", final_prompt );
- return 0;
-#else /* !ENV_TTYPROMPT */
+ if ( env_ttyprompt )
+ {
+ printf( "\r\n%s", final_prompt );
+ tio_mode_sane( tio, FALSE );
+ tio_map_cr( tio, TRUE );
+ tio_set( STDIN, tio );
+ buf[0] = 0;
+ set_env_var( "TTYPROMPT", final_prompt );
+ return 0;
+ }

if ( max_login_time > 0 )
{
@@ -577,9 +590,9 @@
lprintf( L_NOISE, "input finished with '\\r', setting ICRNL ONLCR" );
}

+ tio_drain_output( STDIN ); /* make sure CR+LF has been sent */
tio_set( STDIN, tio );

if ( i == 0 ) return -1;
else return 0;
-#endif /* !ENV_TTYPROMPT */
}
Index: mgetty.c
===================================================================
RCS file: /u2/cvs/mgetty/mgetty.c,v
retrieving revision 4.36
retrieving revision 4.38
diff -u -r4.36 -r4.38
--- mgetty.c 17 Nov 2003 19:08:20 -0000 4.36
+++ mgetty.c 24 Nov 2005 16:58:50 -0000 4.38
@@ -1,4 +1,4 @@
-#ident "$Id: mgetty.c,v 4.36 2003/11/17 19:08:20 gert Exp $ Copyright (c) Gert Doering"
+#ident "$Id: mgetty.c,v 4.38 2005/11/24 16:58:50 gert Exp $ Copyright (c) Gert Doering"

/* mgetty.c
*
@@ -68,7 +68,7 @@
/* logname.c */
int getlogname _PROTO(( char * prompt, TIO * termio,
char * buf, int maxsize, int max_login_time,
- boolean do_fido ));
+ boolean do_fido, boolean env_ttyprompt ));

/* conf_mg.c */
void exit_usage _PROTO((int num));
@@ -1035,7 +1035,7 @@

if ( getlogname( c_string(login_prompt), &tio, buf, sizeof(buf),
c_bool(blocking)? 0: c_int(login_time),
- c_bool(do_send_emsi) ) == -1 )
+ c_bool(do_send_emsi), c_bool(env_ttyprompt) ) == -1 )
{
continue;
}
@@ -1046,9 +1046,7 @@
/* dreadful hack for Linux, set TERM if desired */
if ( c_isset(termtype) )
{
- char * t = malloc( 6 + strlen( c_string(termtype)) );
- if ( t != NULL )
- { sprintf( t, "TERM=%s", c_string(termtype) ); putenv(t); }
+ set_env_var( "TERM", c_string(termtype) );
}

/* catch "standard question #29" (DCD low -> /bin/login gets stuck) */
Index: conf_mg.c
===================================================================
RCS file: /u2/cvs/mgetty/conf_mg.c,v
retrieving revision 4.15
retrieving revision 4.16
diff -u -r4.15 -r4.16
--- conf_mg.c 27 Jan 2001 16:22:37 -0000 4.15
+++ conf_mg.c 24 Nov 2005 16:57:58 -0000 4.16
@@ -1,4 +1,4 @@
-#ident "$Id: conf_mg.c,v 4.15 2001/01/27 16:22:37 gert Exp $ Copyright (c) Gert Doering"
+#ident "$Id: conf_mg.c,v 4.16 2005/11/24 16:57:58 gert Exp $ Copyright (c) Gert Doering"

/* conf_mg.c
*
@@ -106,6 +106,7 @@
{ "login-time", {0}, CT_INT, C_EMPTY },
#endif
{ "fido-send-emsi", {TRUE}, CT_BOOL, C_PRESET },
+ { "login-env-ttyprompt-hack", {FALSE}, CT_BOOL, C_PRESET },

#ifdef LOGIN_CFG_FILE
{ "login-conf-file", {(p_int) LOGIN_CFG_FILE}, CT_STRING, C_PRESET },
Index: conf_mg.h
===================================================================
RCS file: /u2/cvs/mgetty/conf_mg.h,v
retrieving revision 4.10
retrieving revision 4.11
diff -u -r4.10 -r4.11
--- conf_mg.h 5 Jan 2001 18:03:58 -0000 4.10
+++ conf_mg.h 24 Nov 2005 16:57:58 -0000 4.11
@@ -1,4 +1,4 @@
-#ident "$Id: conf_mg.h,v 4.10 2001/01/05 18:03:58 gert Exp $ Copyright (c) 1994 Gert Doering"
+#ident "$Id: conf_mg.h,v 4.11 2005/11/24 16:57:58 gert Exp $ Copyright (c) 1994 Gert Doering"

/* all (dynamic) mgetty configuration is contained in this structure.
* It is initialized and loaded in conf_mg.c and accessed from mgetty.c
@@ -47,6 +47,7 @@
login_prompt,
login_time, /* max. time to log in */
do_send_emsi, /* send EMSI_REQ string */
+ env_ttyprompt, /* suppress login prompt */
login_config, /* login.config file name */

station_id, /* local fax station ID */
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany ***@greenie.muc.de
fax: +49-89-35655025 ***@net.informatik.tu-muenchen.de

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Scott Markwell
2005-11-25 09:28:19 UTC
Permalink
I'm away from the office currently (Thanksgiving etc) I'll be in on
Sunday and give it a shake down and let you know.
Post by Gert Doering
Hi,
Post by Scott Markwell
I'd like to request that this functionality be added to a future
build, to be configurable at runtime. The issue being is patch
management, where applying a patch across multiple systems remotely
isn't easy under SUSE to do if the patches must be deployed as source
packages.
ok, here we go. You asked for it, you test it :-)
The patch below is against "pristine" 1.1.33, and adds the run-time
option "login-env-ttyprompt-hack yes/no" (default=no) to mgetty.config.
All I can say is "it compiles, and the code looks good", but I have
NOT tested it.
I'd appreciate if you could do a quick test on both variants, and tell
me if it works.
gert
------------- snip --------------
Index: logname.c
===================================================================
RCS file: /u2/cvs/mgetty/logname.c,v
retrieving revision 4.9
retrieving revision 4.11
diff -u -r4.9 -r4.11
--- logname.c 17 Aug 2003 10:38:36 -0000 4.9
+++ logname.c 24 Nov 2005 16:58:32 -0000 4.11
@@ -1,10 +1,20 @@
-#ident "$Id: logname.c,v 4.9 2003/08/17 10:38:36 gert Exp $ Copyright (c) Gert Doering"
+#ident "$Id: logname.c,v 4.11 2005/11/24 16:58:32 gert Exp $ Copyright (c) Gert Doering"
/* logname.c
*
* print 'login:' prompt, handling eventual escape sequence substitutions
*
* read login name, detect incoming PPP frames and FIDO startup sequences
+ *
+ * $Log: logname.c,v $
+ * Revision 4.11 2005/11/24 16:58:32 gert
+ * add extra flag, env_ttyprompt, that replaces #ifdef ENV_TTYPROMPT
+ *
+ * Revision 4.10 2005/04/25 21:09:13 gert
+ * drain tty output before changing CR/LF settings after reading login name
+ * (this was a race condition on very fast machines that lead to confused
+ * tty drivers - and there is no good reason NOT to let the output drain)
+ *
*/
@@ -257,9 +267,11 @@
* If ENV_TTYPROMPT is set, do not read anything
*/
-int getlogname _P6( (prompt, tio, buf, maxsize, max_login_time, do_fido),
+int getlogname _P7( (prompt, tio, buf, maxsize, max_login_time,
+ do_fido, env_ttyprompt),
char * prompt, TIO * tio, char * buf,
- int maxsize, int max_login_time, boolean do_fido )
+ int maxsize, int max_login_time,
+ boolean do_fido, boolean env_ttyprompt )
{
int i, r;
char ch;
@@ -278,15 +290,16 @@
final_prompt = ln_escape_prompt( prompt );
-#ifdef ENV_TTYPROMPT
- printf( "\r\n%s", final_prompt );
- tio_mode_sane( tio, FALSE );
- tio_map_cr( tio, TRUE );
- tio_set( STDIN, tio );
- buf[0] = 0;
- set_env_var( "TTYPROMPT", final_prompt );
- return 0;
-#else /* !ENV_TTYPROMPT */
+ if ( env_ttyprompt )
+ {
+ printf( "\r\n%s", final_prompt );
+ tio_mode_sane( tio, FALSE );
+ tio_map_cr( tio, TRUE );
+ tio_set( STDIN, tio );
+ buf[0] = 0;
+ set_env_var( "TTYPROMPT", final_prompt );
+ return 0;
+ }
if ( max_login_time > 0 )
{
@@ -577,9 +590,9 @@
lprintf( L_NOISE, "input finished with '\\r', setting ICRNL ONLCR" );
}
+ tio_drain_output( STDIN ); /* make sure CR+LF has been sent */
tio_set( STDIN, tio );
if ( i == 0 ) return -1;
else return 0;
-#endif /* !ENV_TTYPROMPT */
}
Index: mgetty.c
===================================================================
RCS file: /u2/cvs/mgetty/mgetty.c,v
retrieving revision 4.36
retrieving revision 4.38
diff -u -r4.36 -r4.38
--- mgetty.c 17 Nov 2003 19:08:20 -0000 4.36
+++ mgetty.c 24 Nov 2005 16:58:50 -0000 4.38
@@ -1,4 +1,4 @@
-#ident "$Id: mgetty.c,v 4.36 2003/11/17 19:08:20 gert Exp $ Copyright (c) Gert Doering"
+#ident "$Id: mgetty.c,v 4.38 2005/11/24 16:58:50 gert Exp $ Copyright (c) Gert Doering"
/* mgetty.c
*
@@ -68,7 +68,7 @@
/* logname.c */
int getlogname _PROTO(( char * prompt, TIO * termio,
char * buf, int maxsize, int max_login_time,
- boolean do_fido ));
+ boolean do_fido, boolean env_ttyprompt ));
/* conf_mg.c */
void exit_usage _PROTO((int num));
@@ -1035,7 +1035,7 @@
if ( getlogname( c_string(login_prompt), &tio, buf, sizeof(buf),
c_bool(blocking)? 0: c_int(login_time),
- c_bool(do_send_emsi) ) == -1 )
+ c_bool(do_send_emsi), c_bool(env_ttyprompt) ) == -1 )
{
continue;
}
@@ -1046,9 +1046,7 @@
/* dreadful hack for Linux, set TERM if desired */
if ( c_isset(termtype) )
{
- char * t = malloc( 6 + strlen( c_string(termtype)) );
- if ( t != NULL )
- { sprintf( t, "TERM=%s", c_string(termtype) ); putenv(t); }
+ set_env_var( "TERM", c_string(termtype) );
}
/* catch "standard question #29" (DCD low -> /bin/login gets stuck) */
Index: conf_mg.c
===================================================================
RCS file: /u2/cvs/mgetty/conf_mg.c,v
retrieving revision 4.15
retrieving revision 4.16
diff -u -r4.15 -r4.16
--- conf_mg.c 27 Jan 2001 16:22:37 -0000 4.15
+++ conf_mg.c 24 Nov 2005 16:57:58 -0000 4.16
@@ -1,4 +1,4 @@
-#ident "$Id: conf_mg.c,v 4.15 2001/01/27 16:22:37 gert Exp $ Copyright (c) Gert Doering"
+#ident "$Id: conf_mg.c,v 4.16 2005/11/24 16:57:58 gert Exp $ Copyright (c) Gert Doering"
/* conf_mg.c
*
@@ -106,6 +106,7 @@
{ "login-time", {0}, CT_INT, C_EMPTY },
#endif
{ "fido-send-emsi", {TRUE}, CT_BOOL, C_PRESET },
+ { "login-env-ttyprompt-hack", {FALSE}, CT_BOOL, C_PRESET },
#ifdef LOGIN_CFG_FILE
{ "login-conf-file", {(p_int) LOGIN_CFG_FILE}, CT_STRING, C_PRESET },
Index: conf_mg.h
===================================================================
RCS file: /u2/cvs/mgetty/conf_mg.h,v
retrieving revision 4.10
retrieving revision 4.11
diff -u -r4.10 -r4.11
--- conf_mg.h 5 Jan 2001 18:03:58 -0000 4.10
+++ conf_mg.h 24 Nov 2005 16:57:58 -0000 4.11
@@ -1,4 +1,4 @@
-#ident "$Id: conf_mg.h,v 4.10 2001/01/05 18:03:58 gert Exp $ Copyright (c) 1994 Gert Doering"
+#ident "$Id: conf_mg.h,v 4.11 2005/11/24 16:57:58 gert Exp $ Copyright (c) 1994 Gert Doering"
/* all (dynamic) mgetty configuration is contained in this structure.
* It is initialized and loaded in conf_mg.c and accessed from mgetty.c
@@ -47,6 +47,7 @@
login_prompt,
login_time, /* max. time to log in */
do_send_emsi, /* send EMSI_REQ string */
+ env_ttyprompt, /* suppress login prompt */
login_config, /* login.config file name */
station_id, /* local fax station ID */
--
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
--
Scott Markwell

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Scott Markwell
2005-11-29 06:04:54 UTC
Permalink
Patch seems to fail,
Patched agaist mgetty1.1.33-Apr10.tar.gz

boxen:~/Desktop/mgetty 1.1.33/mgetty-1.1.33 # patch <test.p --dry-run
(Stripping trailing CRs from patch.)
patching file logname.c
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 267.
Hunk #3 FAILED at 290.
Hunk #4 FAILED at 590.
4 out of 4 hunks FAILED -- saving rejects to file logname.c.rej
(Stripping trailing CRs from patch.)
patching file mgetty.c
Hunk #1 succeeded at 1 with fuzz 1.
Hunk #2 FAILED at 68.
Hunk #3 FAILED at 1035.
Hunk #4 FAILED at 1046.
3 out of 4 hunks FAILED -- saving rejects to file mgetty.c.rej
(Stripping trailing CRs from patch.)
patching file conf_mg.c
Hunk #1 succeeded at 1 with fuzz 1.
Hunk #2 FAILED at 106.
1 out of 2 hunks FAILED -- saving rejects to file conf_mg.c.rej
(Stripping trailing CRs from patch.)
patching file conf_mg.h
Hunk #1 succeeded at 1 with fuzz 1.
patch unexpectedly ends in middle of line
Hunk #2 FAILED at 47.
1 out of 2 hunks FAILED -- saving rejects to file conf_mg.h.rej
boxen:~/Desktop/mgetty 1.1.33/mgetty-1.1.33 #
Post by Scott Markwell
I'm away from the office currently (Thanksgiving etc) I'll be in on
Sunday and give it a shake down and let you know.
Post by Gert Doering
Hi,
Post by Scott Markwell
I'd like to request that this functionality be added to a future
build, to be configurable at runtime. The issue being is patch
management, where applying a patch across multiple systems remotely
isn't easy under SUSE to do if the patches must be deployed as source
packages.
ok, here we go. You asked for it, you test it :-)
The patch below is against "pristine" 1.1.33, and adds the run-time
option "login-env-ttyprompt-hack yes/no" (default=no) to mgetty.config.
All I can say is "it compiles, and the code looks good", but I have
NOT tested it.
I'd appreciate if you could do a quick test on both variants, and tell
me if it works.
gert
--
Scott Markwell

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
Loading...