| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- Index: servconf.c
- --- servconf.c.orig Fri Jan 23 12:03:10 2004
- +++ servconf.c Fri Mar 12 12:28:21 2004
- @@ -101,6 +101,9 @@
- options->client_alive_count_max = -1;
- options->authorized_keys_file = NULL;
- options->authorized_keys_file2 = NULL;
- +#ifdef USE_ALIAS
- + options->num_alias = 0;
- +#endif
-
- /* Needs to be accessable in many places */
- use_privsep = -1;
- @@ -268,6 +271,9 @@
- sClientAliveCountMax, sAuthorizedKeysFile, sAuthorizedKeysFile2,
- sGssAuthentication, sGssCleanupCreds,
- sUsePrivilegeSeparation,
- +#ifdef USE_ALIAS
- + sAlias,
- +#endif
- sDeprecated, sUnsupported
- } ServerOpCodes;
-
- @@ -366,6 +372,9 @@
- { "authorizedkeysfile", sAuthorizedKeysFile },
- { "authorizedkeysfile2", sAuthorizedKeysFile2 },
- { "useprivilegeseparation", sUsePrivilegeSeparation},
- +#ifdef USE_ALIAS
- + { "alias", sAlias },
- +#endif
- { NULL, sBadOption }
- };
-
- @@ -898,6 +907,26 @@
- while (arg)
- arg = strdelim(&cp);
- break;
- +
- +#ifdef USE_ALIAS
- + case sAlias:
- + if (options->num_alias >= MAX_ALIAS) {
- + fatal("%s line %d: too many user alias defined.",
- + filename, linenum);
- + }
- + arg = strdelim(&cp);
- + if (arg == NULL || arg[0] == '\0')
- + fatal("%s line %d: missing user name alias(es).",
- + filename, linenum);
- + options->alias[options->num_alias].alias = xstrdup(arg);
- + arg = strdelim(&cp);
- + if (arg == NULL || arg[0] == '\0')
- + fatal("%s line %d: missing user name to map alias '%s' to.",
- + filename, linenum, options->alias[options->num_alias].alias);
- + options->alias[options->num_alias].user = xstrdup(arg);
- + options->num_alias++;
- + break;
- +#endif
-
- case sUnsupported:
- logit("%s line %d: Unsupported option %s",
- Index: servconf.h
- --- servconf.h.orig Wed Dec 31 01:37:34 2003
- +++ servconf.h Fri Mar 12 11:36:15 2004
- @@ -125,6 +125,14 @@
- char *authorized_keys_file; /* File containing public keys */
- char *authorized_keys_file2;
- int use_pam; /* Enable auth via PAM */
- +#ifdef USE_ALIAS
- +#define MAX_ALIAS 256
- + u_int num_alias;
- + struct {
- + char *alias; /* the alias list to match */
- + char *user; /* the username to map to */
- + } alias[MAX_ALIAS];
- +#endif
- } ServerOptions;
-
- void initialize_server_options(ServerOptions *);
- Index: auth1.c
- --- auth1.c.orig Sat Nov 22 04:15:30 2003
- +++ auth1.c Fri Mar 12 12:30:48 2004
- @@ -26,6 +26,9 @@
- #include "session.h"
- #include "uidswap.h"
- #include "monitor_wrap.h"
- +#ifdef USE_ALIAS
- +#include "match.h"
- +#endif
-
- /* import */
- extern ServerOptions options;
- @@ -280,6 +283,10 @@
- {
- u_int ulen;
- char *user, *style = NULL;
- +#ifdef USE_ALIAS
- + int i, n;
- + char *cp;
- +#endif
-
- /* Get the name of the user that we wish to log in as. */
- packet_read_expect(SSH_CMSG_USER);
- @@ -290,6 +297,25 @@
-
- if ((style = strchr(user, ':')) != NULL)
- *style++ = '\0';
- +
- +#ifdef USE_ALIAS
- + for (i = 0; i < options.num_alias; i++) {
- + if (match_pattern_list(user, options.alias[i].alias, strlen(options.alias[i].alias), 0) == 1) {
- + if (style != NULL) {
- + n = strlen(options.alias[i].user) + 1 + strlen(style) + 1;
- + cp = xmalloc(n);
- + snprintf(cp, n, "%s:%s", options.alias[i].user, style);
- + style = strchr(cp, ':');
- + *style++ = '\0';
- + }
- + else
- + cp = xstrdup(options.alias[i].user);
- + xfree(user);
- + user = cp;
- + break;
- + }
- + }
- +#endif
-
- authctxt->user = user;
- authctxt->style = style;
- Index: auth2.c
- --- auth2.c.orig Mon Nov 17 11:13:41 2003
- +++ auth2.c Fri Mar 12 12:30:48 2004
- @@ -35,6 +35,9 @@
- #include "dispatch.h"
- #include "pathnames.h"
- #include "monitor_wrap.h"
- +#ifdef USE_ALIAS
- +#include "match.h"
- +#endif
-
- #ifdef GSSAPI
- #include "ssh-gss.h"
- @@ -134,6 +137,10 @@
- Authmethod *m = NULL;
- char *user, *service, *method, *style = NULL;
- int authenticated = 0;
- +#ifdef USE_ALIAS
- + int i, n;
- + char *cp;
- +#endif
-
- if (authctxt == NULL)
- fatal("input_userauth_request: no authctxt");
- @@ -146,6 +153,25 @@
-
- if ((style = strchr(user, ':')) != NULL)
- *style++ = 0;
- +
- +#ifdef USE_ALIAS
- + for (i = 0; i < options.num_alias; i++) {
- + if (match_pattern_list(user, options.alias[i].alias, strlen(options.alias[i].alias), 0) == 1) {
- + if (style != NULL) {
- + n = strlen(options.alias[i].user) + 1 + strlen(style) + 1;
- + cp = xmalloc(n);
- + snprintf(cp, n, "%s:%s", options.alias[i].user, style);
- + style = strchr(cp, ':');
- + *style++ = '\0';
- + }
- + else
- + cp = xstrdup(options.alias[i].user);
- + xfree(user);
- + user = cp;
- + break;
- + }
- + }
- +#endif
-
- if (authctxt->attempt++ == 0) {
- /* setup auth context */
- Index: sshd_config.5
- --- sshd_config.5.orig Wed Feb 18 04:31:24 2004
- +++ sshd_config.5 Fri Mar 12 11:44:55 2004
- @@ -61,6 +61,16 @@
- keywords and their meanings are as follows (note that
- keywords are case-insensitive and arguments are case-sensitive):
- .Bl -tag -width Ds
- +.It Cm Alias
- +Specifies an optional mapping of a list of user name aliases onto
- +real user names. The first argument is a comma separated list of
- +user name aliases (optionally prefixed with '!' for negation) to
- +match. The characters `*' and `?' can be used as wildcards in the
- +alias patterns. The second argument is the real user name onto
- +which the aliases are mapped. This allows the use of appealing
- +virtual login names (like `anonymous') instead of their physical
- +counterparts (like `anoncvs').
- +.Pp
- .It Cm AllowGroups
- This keyword can be followed by a list of group name patterns, separated
- by spaces.
|