]> git.saurik.com Git - apple/system_cmds.git/blobdiff - getty.tproj/main.c
system_cmds-336.1.11.tar.gz
[apple/system_cmds.git] / getty.tproj / main.c
index cafc07dd18d7d84ac52d3d01ba40684aee847b83..3eaa6daa3001727678ba7c49fbe72178aae6a7c2 100644 (file)
@@ -3,22 +3,21 @@
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * "Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
+ * Reserved.  This file contains Original Code and/or Modifications of
+ * Original Code as defined in and that are subject to the Apple Public
+ * Source License Version 1.0 (the 'License').  You may not use this file
+ * except in compliance with the License.  Please obtain a copy of the
+ * License at http://www.apple.com/publicsource and read it before using
+ * this file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
+ * License for the specific language governing rights and limitations
+ * under the License."
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
@@ -63,7 +62,7 @@ static char copyright[] =
 
 #ifndef lint
 /*static char sccsid[] = "from: @(#)main.c     8.1 (Berkeley) 6/20/93";*/
-static char rcsid[] = "$Id: main.c,v 1.1.1.2 2000/01/11 02:10:14 wsanchez Exp $";
+static char rcsid[] = "$Id: main.c,v 1.3 2004/08/26 00:32:22 lindak Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -101,7 +100,7 @@ int crmod, digit, lower, upper;
 
 char   hostname[MAXHOSTNAMELEN];
 struct utsname kerninfo;
-char   name[16];
+char   name[MAXLOGNAME+1];
 char   dev[] = _PATH_DEV;
 char   ttyn[32];
 char   *portselector();
@@ -347,7 +346,7 @@ main(argc, argv)
                        limit.rlim_max = RLIM_INFINITY;
                        limit.rlim_cur = RLIM_INFINITY;
                        (void)setrlimit(RLIMIT_CPU, &limit);
-                       execle(LO, "login", "-p", name, (char *) 0, env);
+                       execle(LO, "login", "-p1", name, (char *) 0, env);
                        syslog(LOG_ERR, "%s: %m", LO);
                        exit(1);
                }
@@ -395,7 +394,7 @@ getname()
                        return (0);
                if (c == EOT)
                        exit(1);
-               if (c == '\r' || c == '\n' || np >= &name[sizeof name]) {
+               if (c == '\r' || c == '\n' || np >= &name[sizeof name-1]) {
                        putf("\r\n");
                        break;
                }