ID |
Date |
Author |
Author Email |
Category |
Subject |
Status |
Last Revision |
35
|
Tue May 24 22:43:38 2011 |
JacekK | doctor99@poczta.onet.pl | Script | Javascript verification of simple attributes with regexp | Beta | Tue May 24 22:46:38 2011 by JacekK | Hi,
I added possibility for a new verification of required fields in generated Javascript "function chkform() ". To do this I added new logbook option "ValidPattern", in which you can set regular expression for an attribute, for example
ValidPattern HexDigits=[0-9a-fA-F]+
If there is a pattern set for required field, then in chkform() function is generated additional verification, if value of the field matches validation regexp.
Changes I made should not decrease performance of elogd. Let me know please if you can add it to regular version.
Jacek |
Attachment 1: JScriptREVerify.patch
|
Index: elogd.c
===================================================================
--- elogd.c (revision 2414)
+++ elogd.c (working copy)
@@ -74,6 +74,8 @@
char attr_list[MAX_N_ATTR][NAME_LENGTH];
char attr_options[MAX_N_ATTR][MAX_N_LIST][NAME_LENGTH];
int attr_flags[MAX_N_ATTR];
+/** Validation pattern for attribute, to test if it contains expected value */
+char attr_valid_pattern[MAX_N_ATTR][NAME_LENGTH];
char attr_list_default[][NAME_LENGTH] = { "Author", "Type", "Category", "Subject", "" };
@@ -7033,7 +7035,7 @@
int scan_attributes(char *logbook)
/* scan configuration file for attributes and fill attr_list, attr_options
- and attr_flags arrays */
+ and attr_flags and attr_valid_pattern arrays */
{
char list[10000], str[NAME_LENGTH], str2[NAME_LENGTH], type[NAME_LENGTH],
tmp_list[MAX_N_ATTR][NAME_LENGTH];
@@ -7062,11 +7064,20 @@
}
}
- /* get options lists for attributes */
+ /* get options lists and validation patterns for attributes */
memset(attr_options, 0, sizeof(attr_options));
+ memset(attr_valid_pattern, 0, sizeof(attr_valid_pattern));
for (i = 0; i < n; i++) {
n_options = 0;
+ sprintf(str, "ValidPattern %s", attr_list[i]);
+ if (getcfg(logbook, str, list, sizeof(list)))
+ {
+ strncpy(attr_valid_pattern[i], list, sizeof(attr_valid_pattern[i])-1);
+ attr_valid_pattern[i][sizeof(attr_valid_pattern[i])-1] = 0;
+ attr_flags[i] |= AF_HAS_VALID_PATT;
+ }
+
sprintf(str, "Options %s", attr_list[i]);
if (getcfg(logbook, str, list, sizeof(list)))
n_options = strbreak(list, attr_options[i], MAX_N_LIST, ",", FALSE);
@@ -9650,6 +9661,17 @@
rsprintf(" document.form1.%s.focus();\n", ua);
rsprintf(" return false;\n");
rsprintf(" }\n");
+ if (attr_flags[i] & AF_HAS_VALID_PATT)
+ {
+ sprintf(str, loc("var validPatt=new RegExp(\"%s\");"), attr_valid_pattern[i]);
+ rsprintf(" %s\n", str);
+ rsprintf(" if (!validPatt.test(document.form1.%s.value)) {\n", ua);
+ sprintf(str, loc("Invalid value for attribute '%s'"), attr_list[i]);
+ rsprintf(" alert(\"%s\");\n", str);
+ rsprintf(" document.form1.%s.focus();\n", ua);
+ rsprintf(" return false;\n");
+ rsprintf(" }\n");
+ }
}
}
Index: elogd.h
===================================================================
--- elogd.h (revision 2414)
+++ elogd.h (working copy)
@@ -192,6 +192,7 @@
#define AF_MUSERLIST (1<<13)
#define AF_USEREMAIL (1<<14)
#define AF_MUSEREMAIL (1<<15)
+#define AF_HAS_VALID_PATT (1<<16)
/* attribute format flags */
#define AFF_SAME_LINE 1
|
27
|
Tue Jan 29 23:18:39 2008 |
Diogo Alves | diogomiguelalves@gmail.com | Script | Multiple file upload for Firefox | Stable | Wed Jan 30 07:56:53 2008 by Stefan Ritt | Here's a firefox extension that works extremely well if one uses drag n'drop to upload several attachment files at once:
https://addons.mozilla.org/en-US/firefox/addon/219
|
10
|
Fri Sep 24 23:14:47 2004 |
Sridhar Anandakrishnan | sak@essc.psu.edu | Script | Perl script to forwar emails to elog | Alpha | | Takes one or more files from the command line that contain MIME
messages, and explodes their contents out into /tmp. The parts
are sent to elog as attachments. |
Attachment 1: doelog
|
#!/usr/bin/perl -w
=head1 NAME
doelog - save a mime message to elog
=head1 SYNOPSIS
doelog <mime-msg-file> <mime-msg-file> ...
someprocess | doelog -
=head1 DESCRIPTION
Takes one or more files from the command line that contain MIME
messages, and explodes their contents out into /tmp. The parts
are sent to elog as attachments.
Modified mimeexplode of the MIME::Tools in perl
This was written as an example of the MIME:: modules in the
MIME-parser package I wrote. It may prove useful as a quick-and-dirty
way of splitting a MIME message if you need to decode something, and
you don't have a MIME mail reader on hand.
=head1 COMMAND LINE OPTIONS
None yet.
=head1 AUTHOR
sak@essc.psu.edu
=cut
BEGIN { unshift @INC, ".." } # to test MIME:: stuff before installing it!
require 5.001;
use strict;
use vars qw($Msgno $cmd);
use MIME::Parser;
use Getopt::Std;
## these should be options too?
## base elog cmd
$cmd = "~/elog -h localhost -p 8080 ";
#------------------------------------------------------------
# dump_entity - dump an entity's file info
#------------------------------------------------------------
sub dump_entity {
my $ent = shift;
my @parts = $ent->parts;
my $file;
die "too many attachments\n" if ($#parts>10);
if (@parts) { # multipart...
map { dump_entity($_) } @parts;
}
else { # single part...append to elog cmd
$file = $ent->bodyhandle->path;
$cmd .= "-f \"$file\" ";
## print $cmd, "\n";
## print " Part: ", $ent->bodyhandle->path,
## " (", scalar($ent->head->mime_type), ")\n";
}
}
#------------------------------------------------------------
# main
#------------------------------------------------------------
sub main {
my $file;
my $entity;
my $subject;
my $logbook;
our($opt_l);
# Sanity:
## (-w ".") or die "cwd not writable, you naughty boy...";
## check if user wants a particular logbook
## fix to add host and port?
getopts('l:');
if($opt_l) { $logbook=$opt_l;} else {$logbook="emails";}
$cmd .= "-l $logbook ";
# Go through messages:
@ARGV or unshift @ARGV, "-";
while (defined($file = shift @ARGV)) {
# Create a new parser object:
my $parser = new MIME::Parser;
# Optional: set up parameters that will affect how it extracts
# documents from the input stream:
$parser->output_under("/tmp");
# Parse an input stream:
open FILE, $file or die "couldn't open $file";
$entity = $parser->read(\*FILE) or
print STDERR "Couldn't parse MIME in $file; continuing...\n";
close FILE;
## get the subject, assumes all logbooks have a subject
## attribute - not necessarily true. Mine do...
chomp($subject = $entity->head->get('Subject', 0));
$cmd .= "-a subject=\"$subject\" ";
print $cmd, "\n";
# Congratulations: you now have a (possibly multipart) MIME entity!
dump_entity($entity) if $entity;
### $entity->dump_skeleton if $entity;
### print $cmd, "\n";
exec $cmd;
}
1;
}
exit (&main ? 0 : -1);
#------------------------------------------------------------
1;
|
46
|
Fri Jul 31 13:52:32 2015 |
TorstenJ | torsten.jakob@jet-services.com | Web site | Problem with Internet Explorer when saving an entry | Stable | Fri May 31 14:20:43 2019 by Stefan Ritt | Hi all,
first off all let me say, that I realy like this great tool. That is a lot of help for keeping our server documentation up-to-date. Thanks to all contributors for that.
I right here, because I actually have an issue with saving entries working with IE11 (but also in IE9). When ever I enter an entry, and click the save button, the page open a page with the text: "OK 1" or the second attemp: "OK 2" 3rd "OK 3" and so on. To get back to my Item list, I have to click the back button in the internet explorer. I also opens a lot of draft entries in my databases. When I submit my entry, I don't have an issue, and the entry is saved correctly.
This issue doesn't happen when using Google Chrome.
Had anyone an simlar issue using elog with IE? It would be great to have some help with that issue.
Thanks
Torsten |
50
|
Tue Jul 26 10:16:22 2016 |
Andreas Luedeke | simon.ebner@psi.ch | Script | Python module to read/write/edit/reply/delete ELOG entries | Stable | Tue Jul 26 10:26:34 2016 by Andreas Luedeke |
Hello Everybody!
I would just like to inform you that there is a new Python module available to access and work with ELOG (read/write/edit/reply/delete).
Currently the module is only supported for Python version 3. The package is pure Python and has no special dependencies. Therefore you can use the package on any machine.
The documentation you can find on https://github.com/paulscherrerinstitute/py_elog
If you want to install the package in an Anaconda on your local machine just use
conda install -c paulscherrerinstitute elog
(also works from outside PSI - the package is available at https://anaconda.org/paulscherrerinstitute/elog)
If there are issues with the package please use the issue tracker that comes with the github repository
https://github.com/paulscherrerinstitute/py_elog/issues or let me know.
Best
Simon |
150
|
Fri Feb 21 19:05:18 2020 |
Laurent Jean-Rigaud | lollspam@free.fr | Other | RPM build process enhancements | Stable | Fri Feb 21 19:14:53 2020 by Laurent Jean-Rigaud | Hi Stefan,
I enclosed a patch for RPM build process available on GIT.
changes :
- rpmbuild :
- checks if provider or custom build (the rm/mv are done on your computers only :-))
- call rpmbuild with version / release given as parameters
- elog.spec :
- last changelog entry date is set to build date
- build with debug for debuginfo rpms (product rpms are normally automatically strimmed)
- elog.init call /etc/ini.d/functions for RHEL/Centos/Fedora/? dists
Todo:
- add RPMbuild options for ldap/pam/...
- enclosed git log in changelog automatically (the dream :-))
|
Attachment 1: elog_patch_for_4936b76915d63a9ebb3788d50d62faadf49cdb6b.patch
|
diff --git a/buildrpm b/buildrpm
index 9d21f4a..dba7067 100755
--- a/buildrpm
+++ b/buildrpm
@@ -12,7 +12,7 @@ set release = $argv[2]
set dir = /tmp/elog-$version
set archive = elog-$version-$release.tar.gz
-perl -wapi.bak -e 's&^(Version:\s+).*$&${1}'"${version}"'&;s&^(Release:\s+).*$&${1}'"${release}"'&;' elog.spec
+#perl -wapi.bak -e 's&^(Version:\s+).*$&${1}'"${version}"'&;s&^(Release:\s+).*$&${1}'"${release}"'&;' elog.spec
# create temporary directory
rm -Rf $dir
@@ -68,19 +68,33 @@ rm -Rf $dir
# transfer archive
echo Transfer archive...
-cp /tmp/$archive ~ritt/html/elog/download/tar/
-cp /tmp/$archive ~ritt/html/elog/download/tar/elog-latest.tar.gz
cp /tmp/$archive ~/rpmbuild/SOURCES/elog-$version.tar.gz
-cd ~ritt/elog
-cp -f doc/ChangeLog ~ritt/html/elog/download/ChangeLog
+# If Stefan...
+if ( -d /home/ritt ) then
+ echo "Manager mode"
+ if ( -d ~ritt/html/elog/download/tar ) then
+ cp /tmp/$archive ~ritt/html/elog/download/tar/
+ cp /tmp/$archive ~ritt/html/elog/download/tar/elog-latest.tar.gz
+ cd ~ritt/elog
+ cp -f doc/ChangeLog ~ritt/html/elog/download/ChangeLog
+ endif
+endif
+cd -
rm -f /tmp/$archive
+echo Cleanup $version-$release rpms
+rm -f ~/rpmbuild/RPMS/*/elog*${version}-${release}*.rpm
+rm -f ~/rpmbuild/SRPMS/elog*${version}-${release}*.rpm
# building RPMs
-echo Build RPMs...
-rm -f ~/rpmbuild/RPMS/x86_64/*
-rm -f ~/rpmbuild/SRPMS/*
-rpmbuild -ba elog.spec || exit $?
-cp ~/rpmbuild/RPMS/x86_64/elog*rpm ~ritt/html/elog/download/RPMS/
-cp ~/rpmbuild/RPMS/x86_64/elog-$version-$release.x86_64.rpm ~ritt/html/elog/download/RPMS/elog-latest.x86_64.rpm
-cp ~/rpmbuild/SRPMS/elog*rpm ~ritt/html/elog/download/SRPMS/
-cp ~/rpmbuild/SRPMS/elog-$version-$release.src.rpm ~ritt/html/elog/download/SRPMS/elog-latest.src.rpm
+echo Build RPMs..
+rpmbuild -ba --define "version ${version}" --define "release ${release}" elog.spec || exit $?
+
+# If Stefan...
+if ( -d /home/ritt ) then
+ if ( -d ~ritt/html/elog/download/tar ) then
+ cp ~/rpmbuild/RPMS/x86_64/elog*rpm ~ritt/html/elog/download/RPMS/
+ cp ~/rpmbuild/RPMS/x86_64/elog-$version-$release.x86_64.rpm ~ritt/html/elog/download/RPMS/elog-latest.x86_64.rpm
+ cp ~/rpmbuild/SRPMS/elog*rpm ~ritt/html/elog/download/SRPMS/
+ cp ~/rpmbuild/SRPMS/elog-$version-$release.src.rpm ~ritt/html/elog/download/SRPMS/elog-latest.src.rpm
+ endif
+endif
diff --git a/elog.spec b/elog.spec
index 16add8f..8397eab 100755
--- a/elog.spec
+++ b/elog.spec
@@ -1,9 +1,13 @@
-# OpenSSH privilege separation requires a user & group ID
+# ELOG weblog application
+# rpmbuild -ba --define 'version 3.1.4' --define 'release 2' --define "date $(LC_TIME=En date '+%a %b %d %Y')" elog.spec
+
+#define date $(LC_TIME=En date '+%a %b %d %Y')
+%define build_timestamp %(LC_TIME=En date '+%a %b %d %Y')
Name: elog
Summary: elog is a standalone electronic web logbook
-Version: 3.1.4
-Release: 2
+Version: %version
+Release: %release%{?dist}
License: GPL
Group: Applications/Networking
Source: http://elog.psi.ch/elog/download/elog-%{version}.tar.gz
@@ -41,6 +45,8 @@ access control, etc. Moreover, a single server can host several weblogs, and
each weblog can be totally different from the rest.
%changelog
+* %{build_timestamp} Stefan Ritt <stefan.ritt@psi.ch> %version-%release
+- Updated from git
* Wed Sep 26 2018 Stefan Ritt <stefan.ritt@psi.ch>
- Made adjustments for new elog server and RH7
* Fri Aug 29 2014 Stefan Ritt <stefan.ritt@psi.ch>
@@ -72,7 +78,7 @@ each weblog can be totally different from the rest.
-g elog -M -r elog 2>/dev/null || :
%build
-make
+make CFLAGS='-O3 -funroll-loops -fomit-frame-pointer -W -Wall -Wno-deprecated-declarations -Imxml -g'
sed "s#\@PREFIX\@#%{prefix}#g" elogd.init_template > elogd.init
%install
diff --git a/elogd.init b/elogd.init
index 5d4e7ee..e04143c 100644
--- a/elogd.init
+++ b/elogd.init
@@ -6,6 +6,9 @@
# config: /usr/local/elog/elogd.cfg
# pidfile: /var/run/elogd.pid
+# RHEL
+[ -f /etc/init.d/functions ] && . /etc/init.d/functions
+
# Check for the config file
if [ ! -f /usr/local/elog/elogd.cfg ]; then
exit 0
diff --git a/elogd.init_template b/elogd.init_template
index e94b5d7..bb1b330 100755
--- a/elogd.init_template
+++ b/elogd.init_template
@@ -6,6 +6,9 @@
# config: @PREFIX@/elog/elogd.cfg
# pidfile: /var/run/elogd.pid
+# RHEL
+[ -f /etc/init.d/functions ] && . /etc/init.d/functions
+
# Check for the config file
if [ ! -f @PREFIX@/elog/elogd.cfg ]; then
exit 0
|
34
|
Fri Feb 4 10:26:38 2011 |
Stefan Ritt | stefan.ritt@psi.ch | Other | Re: Building elog on OpenBSD | Stable | |
T. Ribbrock wrote: |
Two things are required to get elog (tested with 2.8.1) to compile on OpenBSD (tested on OpenBSD 4.8):
Step 1 - Patch Makefile:
--- Makefile~ Mon Jan 24 21:38:09 2011
+++ Makefile Mon Jan 24 21:42:57 2011
@@ -50,6 +50,10 @@
RM = /usr/bin/rm -f
endif
+ifeq ($(OSTYPE),OpenBSD)
+LIBS += -lcrypto
+endif
+
ifeq ($(OSTYPE),Darwin)
OSTYPE=darwin
endif
Step 2 - Use "gmake" instead of the standard "make" to build.
|
Thanks, I added your patch to the distribution. |
53
|
Sat Sep 16 15:47:16 2017 |
David Pilgram | David.Pilgram@epost.org.uk | Script | Re: Check logbook files for wrong references | Stable | Sat Sep 16 15:52:58 2017 by David Pilgram | I had to modify the script because I'm still on elog 2.9.2, where there are not subdirectories (by year) for
each logbook. Line 5 had to be changed to
$logf=q/[0-9][0-9][01][0-9][0-3][0-9]a.log/;
to do this.
Once done, I found the deliberate orphan script that I had put in to test, and rather too many other orphans than I had expected. One or two I cannot explain. If I had clicked on any of those entries elog would have gone into infinate loop.
A very useful utility. Thanks Andreas!
Andreas Luedeke wrote: |
You can run this little script to check if all entries referenced "In reply to:" do actually exist.
To use it, you first need to "cd" to your logbook directory ("cd /usr/local/elog/logbooks") and then run it without arguments "logcheck".
If it finds references pointing to a missing entry, it'll print the path to the file with the offending reference and some lines. For example:
### error: reference to entry 146, that exists 0 times. Reference is:
### Proscan/2012/120507a.log-<p>[...].</p>
### Proscan/2012/120507a.log-$ @ MID @ $: 147
### Proscan/2012/120507a.log-Date: Mon, 07 May 2012 13:44:03 +0200
### Proscan/2012/120507a.log:In reply to: 146
### Proscan/2012/120507a.log-Wann: 1336373261
### Proscan/2012/120507a.log-Autor: [...]
### Proscan/2012/120507a.log-Eintrag: Problem
[...]-
Very often this happens if an entry is deleted AFTER someone already replied to it. Normally that is no problem, but in some cases you might get infinite loops and that causes ELOG to hang. The script is not checking for loops, but wrong references might give you a hint where to look.
The script will print duplicate entries as well, if the referenced entry exist more than once.
Cheers, Andreas
PS: never include the string "$ @ MID @ $:" without spaces in an ELOG entry: apparently ELOG cuts off all text from that token on.
|
|
23
|
Fri Jul 13 12:36:45 2007 |
Stefan Ritt | stefan.ritt@psi.ch | Other | Re: Compiling elogd.c on HP-UX 64 bit | Beta | Thu Jul 12 09:38:47 2007 by Peter Rienstra | I applied most of your patches to the elog source code, SVN revision 1885. The only missing piece has to do with seteuid/setuid. I definitively need seteuid for linux, because elogd might be started under root, then it falls back to an optional elog user. But when it stops, it has to restore the original root user in order to delete the PID file (/var/run/elogd.pid) which was created under root. If seteuid does not exist under HP-UX, you should add something like
#ifdef HP-UX
setuid(...)
#else
seteuid(...)
#endif
Probably the HP-UX has to be something else, but I cannot test this since I don't have such an OS here. Once you get this working I can put it into the standard distribution. |
24
|
Mon Jul 16 15:27:08 2007 |
Peter Rienstra | peter.rienstra@gmail.com | Other | Re: Compiling elogd.c on HP-UX 64 bit | Beta | Thu Jul 12 09:38:47 2007 by Peter Rienstra | Stefan,
First I want to say I really like your program. We work in a small group of 5 database administrators, and this is exactly what we need to inform each other. Elog is simple but very functional, so thanks!
My problem is that I don't have root access to the HP-UX machines. We don't run elogd as root, so I wasn't really interested in the seteuid functionality, I just wanted to compile and run the program.
HP-UX doesn't have the "seteuid" and "setegid" functions. But there are "setuid+setgid", "setreuid+setregid" and "setresuid+setresgid" functions available. I'm not sure which one is the best to use. I uploaded the manpages as attachment. I hope this will help you.
If you want I can do a compile and run test on HP-UX with your altered source code. But I can't do a test with "root".
Stefan Ritt wrote: | I applied most of your patches to the elog source code, SVN revision 1885. The only missing piece has to do with seteuid/setuid. I definitively need seteuid for linux, because elogd might be started under root, then it falls back to an optional elog user. But when it stops, it has to restore the original root user in order to delete the PID file (/var/run/elogd.pid) which was created under root. If seteuid does not exist under HP-UX, you should add something like
#ifdef HP-UX
setuid(...)
#else
seteuid(...)
#endif
Probably the HP-UX has to be something else, but I cannot test this since I don't have such an OS here. Once you get this working I can put it into the standard distribution. |
|
Attachment 1: man_setuid.txt
|
setuid(2) setuid(2)
NAME
setuid(), setgid() - set user and group IDs
SYNOPSIS
#include <unistd.h>
int setuid(uid_t uid);
int setgid(gid_t gid);
DESCRIPTION
setuid() sets the real-user-ID (ruid), effective-user-ID (euid),
and/or saved-user-ID (suid) of the calling process. If the Security
Containment product is installed, these interfaces treat a process
observing CHSUBJIDENT as a privileged process. Otherwise, only
processes with an euid of zero are treated as privileged processes.
See privileges(5) for more information on Security Containment and
fine-grained privileges.
The following conditions govern setuid's behavior:
+ If the process is privileged, setuid() sets the ruid, euid,
and suid to uid.
+ If the process is not privileged and the argument uid is equal
to the ruid or the suid, setuid() sets the euid to uid; the
ruid and suid remain unchanged. (If a set-user-ID program is
not running as superuser, it can change its euid to match its
ruid and reset itself to the previous euid value.)
+ If the process is not privileged, the argument uid is equal to
the euid, and the calling process has the PRIV_SETRUGID
privilege, setuid() sets the ruid to uid; the euid and suid
remain unchanged.
setgid() sets the real-group-ID (rgid), effective-group-ID (egid),
and/or saved-group-ID (sgid) of the calling process. The following
conditions govern setgid()'s behavior:
+ If the process is privileged, setgid() sets the rgid and egid
to gid.
+ If the process is not privileged and the argument gid is equal
to the rgid or the sgid, setgid() sets the egid to gid; the
rgid and sgid remain unchanged.
+ If the process is not privileged, the argument gid is equal to
the egid, and the calling process has the PRIV_SETRUGID
privilege, setgid() sets the rgid to gid; the egid and sgid
remain unchanged.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: May 2006
setuid(2) setuid(2)
Security Restrictions
Some or all of the actions associated with this system call require
the CHSUBJIDENT privilege. Processes owned by the superuser have this
privilege. Processes owned by other users may have this privilege,
depending on system configuration.
See privileges(5) for more information about privileged access on
systems that support fine-grained privileges.
RETURN VALUE
Upon successful completion, setuid() and setgid() return 0; otherwise,
they return -1 and set errno to indicate the error.
ERRORS
setuid() and setgid() fail and return -1 if any of the following
conditions are encountered:
[EPERM] None of the conditions above are met.
[EINVAL] uid (gid) is not a valid user (group) ID.
WARNINGS
It is recommended that the PRIV_SETRUGID capability be avoided, as it
is provided for backward compatibility. This feature may be modified
or dropped from future HP-UX releases. When changing the real user ID
and real group ID, use of setresuid() and setresgid() (see
setresuid(2)) is recommended instead.
AUTHOR
setuid() was developed by AT&T, the University of California,
Berkeley, and HP.
setgid() was developed by AT&T.
SEE ALSO
exec(2), getuid(2), setresuid(2), privileges(5).
STANDARDS CONFORMANCE
setuid(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
setgid(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: May 2006
|
Attachment 2: man_setreuid.txt
|
setreuid(2) setreuid(2)
NAME
setreuid - set real and effective user IDs
SYNOPSIS
#include <unistd.h>
int setreuid(uid_t ruid, uid_t euid);
DESCRIPTION
The setreuid() function sets the real and effective user IDs of the
current process to the values specified by the ruid and euid
arguments. If ruid or euid is -1, the corresponding effective or real
user ID of the current process is left unchanged.
A process with appropriate privileges can set either ID to any value.
An unprivileged process can only set the effective user ID if the euid
argument is equal to either the real, effective, or saved user ID of
the process.
It is unspecified whether a process without appropriate privileges is
permitted to change the real user ID to match the current real,
effective or saved user ID of the process.
RETURN VALUE
Upon successful completion, 0 is returned. Otherwise, -1 is returned
and errno is set to indicate the error.
ERRORS
The setreuid() function will fail if:
[EINVAL] The value of the ruid or euid argument
is invalid or out-of-range.
[EPERM] The current process does not have
appropriate privileges, and either an
attempt was made to change the effective
user ID to a value other than the real
user ID or the saved set-user-ID or an
attempt was made to change the real user
ID to a value not permitted by the
implementation.
SEE ALSO
getuid(2), setuid(2), <unistd.h>.
CHANGE HISTORY
First released in Issue 4, Version 2.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
|
Attachment 3: man_setresuid.txt
|
setresuid(2) setresuid(2)
NAME
setresuid, setresgid - set real, effective, and saved user and group
IDs
SYNOPSIS
#include <unistd.h>
int setresuid(uid_t ruid, uid_t euid, uid_t suid);
int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
DESCRIPTION
setresuid() sets the real, effective and/or saved user ID of the
calling process.
If the current real, effective or saved user ID is equal to that of a
user having appropriate privileges, setresuid() sets the real,
effective and saved user IDs to ruid, euid, and suid, respectively.
Otherwise, setresuid() only sets the real, effective, and saved user
IDs if ruid, euid, and suid each match at least one of the current
real, effective, or saved user IDs.
If ruid, euid, or suid is -1, setresuid() leaves the current real,
effective or saved user ID unchanged.
setresgid() sets the real, effective and/or saved group ID of the
calling process.
If the current real, effective or saved user ID is equal to that of a
user having appropriate privileges, setresgid() sets the real,
effective, and saved group ID to rgid, egid, and sgid, respectively.
Otherwise, setresgid() only sets the real, effective and saved group
ID if rgid, egid, and sgid each match at least one of the current
real, effective or saved group ID.
If rgid, egid, or sgid is -1, setresgid() leaves the current real,
effective or saved group ID unchanged.
Security Restrictions
Some or all of the actions associated with this system call require
the PRIV_CHSUBJIDENT privilege (CHSUBJIDENT). Processes owned by the
superuser will have this privilege. Processes owned by other users
may have this privilege, depending on system configuration. See
privileges(5) for more information about privileged access on systems
that support fine-grained privileges.
RETURN VALUE
Upon successful completion, setresuid() and setresgid() return 0;
otherwise, they return -1 and set errno to indicate the error.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: May 2005
setresuid(2) setresuid(2)
ERRORS
setresuid() and setresgid() fail if any of the following conditions
are encountered:
[EINVAL] ruid, euid, or suid (rgid, egid, or sgid) is not a
valid user (group) ID.
[EPERM] None of the conditions above are met.
AUTHOR
setresuid() and setresgid() were developed by HP.
SEE ALSO
exec(2), getuid(2), setuid(2).
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: May 2005
|
|