--- a/usr/src/cmd/rad/mod/rad_defaults.c Thu Mar 03 13:50:32 2011 -0500
+++ b/usr/src/cmd/rad/mod/rad_defaults.c Thu Mar 03 14:39:37 2011 -0800
@@ -20,10 +20,11 @@
*/
/*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
*/
#include <sys/types.h>
+#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
@@ -31,6 +32,8 @@
#include <fcntl.h>
#include <limits.h>
#include <unistd.h>
+#include <pwd.h>
+#include <grp.h>
#include "rad_defaults.h"
#include "rad_modapi.h"
@@ -212,7 +215,12 @@
}
(void) fclose(rfile);
- if (fclose(wfile) != 0 || rename(wfname, fname) != 0) {
+
+ struct group *gsys = getgrnam("sys");
+ struct passwd *uroot = getpwnam("root");
+ if (fclose(wfile) != 0 || gsys == NULL || uroot == NULL ||
+ chown(wfname, uroot->pw_uid, gsys->gr_gid) != 0 ||
+ chmod(wfname, 0644) || rename(wfname, fname) != 0) {
error = errno;
(void) unlink(wfname);
return (error);