summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authordtucker <dtucker>2010-11-05 01:03:05 +0000
committerdtucker <dtucker>2010-11-05 01:03:05 +0000
commitb0a59209bc5dafb5aa5dc32779bcca731f6950ca (patch)
tree485fdf8ff501f3c0e66646b713959b49cd09e649 /openbsd-compat
parent491c457a5190aea0e17b6275561fdca601ef1c57 (diff)
downloadopenssh-b0a59209bc5dafb5aa5dc32779bcca731f6950ca.tar.gz
- (dtucker) [configure.ac platform.{c,h} session.c
openbsd-compat/port-solaris.{c,h}] Bug #1824: Add Solaris Project support. Patch from cory.erickson at csu mnscu edu with a bit of rework from me. ok djm@
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/port-solaris.c32
-rw-r--r--openbsd-compat/port-solaris.h5
2 files changed, 35 insertions, 2 deletions
diff --git a/openbsd-compat/port-solaris.c b/openbsd-compat/port-solaris.c
index 2ab64d48..25382f1c 100644
--- a/openbsd-compat/port-solaris.c
+++ b/openbsd-compat/port-solaris.c
@@ -1,4 +1,4 @@
-/* $Id: port-solaris.c,v 1.3 2006/10/31 23:28:49 dtucker Exp $ */
+/* $Id: port-solaris.c,v 1.4 2010/11/05 01:03:05 dtucker Exp $ */
/*
* Copyright (c) 2006 Chad Mynhier.
@@ -197,3 +197,33 @@ solaris_contract_post_fork_parent(pid_t pid)
close(ctl_fd);
}
#endif
+
+#ifdef USE_SOLARIS_PROJECTS
+#include <sys/task.h>
+#include <project.h>
+
+/*
+ * Get/set solaris default project.
+ * If we fail, just run along gracefully.
+ */
+void
+solaris_set_default_project(struct passwd *pw)
+{
+ struct project *defaultproject;
+ struct project tempproject;
+ char buf[1024];
+
+ /* get default project, if we fail just return gracefully */
+ if ((defaultproject = getdefaultproj(pw->pw_name, &tempproject, &buf,
+ sizeof(buf))) > 0) {
+ /* set default project */
+ if (setproject(defaultproject->pj_name, pw->pw_name,
+ TASK_NORMAL) != 0)
+ debug("setproject(%s): %s", defaultproject->pj_name,
+ strerror(errno));
+ } else {
+ /* debug on getdefaultproj() error */
+ debug("getdefaultproj(%s): %s", pw->pw_name, strerror(errno));
+ }
+}
+#endif /* USE_SOLARIS_PROJECTS */
diff --git a/openbsd-compat/port-solaris.h b/openbsd-compat/port-solaris.h
index 4c324871..cd442e78 100644
--- a/openbsd-compat/port-solaris.h
+++ b/openbsd-compat/port-solaris.h
@@ -1,4 +1,4 @@
-/* $Id: port-solaris.h,v 1.1 2006/08/30 17:24:42 djm Exp $ */
+/* $Id: port-solaris.h,v 1.2 2010/11/05 01:03:05 dtucker Exp $ */
/*
* Copyright (c) 2006 Chad Mynhier.
@@ -20,8 +20,11 @@
#include <sys/types.h>
+#include <pwd.h>
+
void solaris_contract_pre_fork(void);
void solaris_contract_post_fork_child(void);
void solaris_contract_post_fork_parent(pid_t pid);
+void solaris_set_default_project(struct passwd *);
#endif