Print this page
2989 Eliminate use of LOGNAME_MAX in ON
1166 useradd have warning with name more 8 chars
*** 18,33 ****
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
- #pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/task.h>
#include <alloca.h>
#include <libproc.h>
--- 18,33 ----
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
+ * Copyright (c) 2013 Gary Mills
+ *
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/types.h>
#include <sys/task.h>
#include <alloca.h>
#include <libproc.h>
*** 652,662 ****
* function will re-use the memory previously returned.
*/
static struct passwd *
match_user(uid_t uid, char *projname, int is_my_uid)
{
! char prbuf[PROJECT_BUFSZ], username[LOGNAME_MAX+1];
struct project prj;
char *tmp_name;
struct passwd *pw = NULL;
/*
--- 652,662 ----
* function will re-use the memory previously returned.
*/
static struct passwd *
match_user(uid_t uid, char *projname, int is_my_uid)
{
! char prbuf[PROJECT_BUFSZ], username[LOGNAME_MAX_ILLUMOS+1];
struct project prj;
char *tmp_name;
struct passwd *pw = NULL;
/*
*** 694,704 ****
* allow this.
*/
if (projname == NULL || getuid() == (uid_t)0)
return (pw);
! (void) strcpy(username, pw->pw_name);
if (inproj(username, projname, prbuf, PROJECT_BUFSZ) == 0) {
char **u;
tmp_name = NULL;
--- 694,705 ----
* allow this.
*/
if (projname == NULL || getuid() == (uid_t)0)
return (pw);
! (void) strncpy(username, pw->pw_name, sizeof (username) - 1);
! username[sizeof (username) - 1] = '\0';
if (inproj(username, projname, prbuf, PROJECT_BUFSZ) == 0) {
char **u;
tmp_name = NULL;