mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
1998-06-22 17:02 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/enbl-secure.c: Don't use __libc_uid. * sysdeps/unix/sysv/linux/aio_sigqueue.c: Likewise. * sysdeps/unix/sysv/linux/sigqueue.c: Likewise. * sysdeps/unix/sysv/linux/init-first.c: Don't initialize __libc_uid. 1998-06-02 Gordon Matzigkeit <gord@profitpress.com> * mach/Makefile: Change `mv' invocations to `mv -f'. * mach/Machrules: Likewise. 1998-06-22 Andreas Jaeger <aj@arthur.rhein-neckar.de> * config.make.in (old-glibc-headers): Add it. * configure.in: Add test for glibc 2.0.x headers. * Makefile (headers2_0): New variable - contains so far only Linux/Intel glibc 2.0.x headers. (remove-old-headers): New rule to remove headers from glibc 2.0.x. (install): Depend on remove-old-headers. 1998-06-19 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/generic/ftruncate.c: Define function as __ftruncate and make ftruncate a weak alias. * sysdeps/mach/hurd/ftruncate.c: Really define function as __ftruncate. * sysdeps/mach/hurd/truncate.c: Include <unistd.h>. (truncate): Fix function defenition to match prototype. 1998-06-20 Mark Kettenis <kettenis@phys.uva.nl> * manual/terminal.texi: Document ttyname_r, getpt, grantpt, unlockpt, ptsname, ptsname_r, openpty and forkpty. 1998-06-22 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/glob.c: Make it possible to include glob.h before loading glob.c. Reported by Felix von Leitner <leitner@math.fu-berlin.de>. 1998-06-22 Andreas Jaeger <aj@arthur.rhein-neckar.de> * nscd/connections.c: Use poll() instead of select(). 1998-06-22 14:08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/generic/Dist: Fix typo. 1998-06-20 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/nis_add.c: Avoid unnecessary strlen () calls. * nis/nis_addmember.c: Likewise. * nis/nis_call.c: Likewise. * nis/nis_creategroup.c: Likewise. * nis/nis_destroygroup.c: Likewise. * nis/nis_findserv.c: Likewise. * nis/nis_ismember.c: Likewise. * nis/nis_print.c: Likewise. * nis/nis_print_group_entry.c: Likewise. * nis/nis_removemember.c: Likewise. * nis/nis_verifygroup.c: Likewise. * nis/ypclnt.c: Likewise. * nis/nis_file.c: Close file handles. * nis/nis_callback.c: Fix typo.
This commit is contained in:
70
ChangeLog
70
ChangeLog
@ -1,3 +1,73 @@
|
|||||||
|
1998-06-22 17:02 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* sysdeps/generic/enbl-secure.c: Don't use __libc_uid.
|
||||||
|
* sysdeps/unix/sysv/linux/aio_sigqueue.c: Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/sigqueue.c: Likewise.
|
||||||
|
* sysdeps/unix/sysv/linux/init-first.c: Don't initialize __libc_uid.
|
||||||
|
|
||||||
|
1998-06-02 Gordon Matzigkeit <gord@profitpress.com>
|
||||||
|
|
||||||
|
* mach/Makefile: Change `mv' invocations to `mv -f'.
|
||||||
|
* mach/Machrules: Likewise.
|
||||||
|
|
||||||
|
1998-06-22 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||||
|
|
||||||
|
* config.make.in (old-glibc-headers): Add it.
|
||||||
|
|
||||||
|
* configure.in: Add test for glibc 2.0.x headers.
|
||||||
|
|
||||||
|
* Makefile (headers2_0): New variable - contains so far only
|
||||||
|
Linux/Intel glibc 2.0.x headers.
|
||||||
|
(remove-old-headers): New rule to remove headers from glibc 2.0.x.
|
||||||
|
(install): Depend on remove-old-headers.
|
||||||
|
|
||||||
|
1998-06-19 Mark Kettenis <kettenis@phys.uva.nl>
|
||||||
|
|
||||||
|
* sysdeps/generic/ftruncate.c: Define function as __ftruncate and
|
||||||
|
make ftruncate a weak alias.
|
||||||
|
* sysdeps/mach/hurd/ftruncate.c: Really define function as
|
||||||
|
__ftruncate.
|
||||||
|
* sysdeps/mach/hurd/truncate.c: Include <unistd.h>.
|
||||||
|
(truncate): Fix function defenition to match prototype.
|
||||||
|
|
||||||
|
1998-06-20 Mark Kettenis <kettenis@phys.uva.nl>
|
||||||
|
|
||||||
|
* manual/terminal.texi: Document ttyname_r, getpt, grantpt,
|
||||||
|
unlockpt, ptsname, ptsname_r, openpty and forkpty.
|
||||||
|
|
||||||
|
1998-06-22 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* sysdeps/generic/glob.c: Make it possible to include glob.h
|
||||||
|
before loading glob.c.
|
||||||
|
Reported by Felix von Leitner <leitner@math.fu-berlin.de>.
|
||||||
|
|
||||||
|
1998-06-22 Andreas Jaeger <aj@arthur.rhein-neckar.de>
|
||||||
|
|
||||||
|
* nscd/connections.c: Use poll() instead of select().
|
||||||
|
|
||||||
|
1998-06-22 14:08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
|
||||||
|
|
||||||
|
* sysdeps/generic/Dist: Fix typo.
|
||||||
|
|
||||||
|
1998-06-20 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
|
||||||
|
|
||||||
|
* nis/nis_add.c: Avoid unnecessary strlen () calls.
|
||||||
|
* nis/nis_addmember.c: Likewise.
|
||||||
|
* nis/nis_call.c: Likewise.
|
||||||
|
* nis/nis_creategroup.c: Likewise.
|
||||||
|
* nis/nis_destroygroup.c: Likewise.
|
||||||
|
* nis/nis_findserv.c: Likewise.
|
||||||
|
* nis/nis_ismember.c: Likewise.
|
||||||
|
* nis/nis_print.c: Likewise.
|
||||||
|
* nis/nis_print_group_entry.c: Likewise.
|
||||||
|
* nis/nis_removemember.c: Likewise.
|
||||||
|
* nis/nis_verifygroup.c: Likewise.
|
||||||
|
* nis/ypclnt.c: Likewise.
|
||||||
|
|
||||||
|
* nis/nis_file.c: Close file handles.
|
||||||
|
|
||||||
|
* nis/nis_callback.c: Fix typo.
|
||||||
|
|
||||||
1998-06-10 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
|
1998-06-10 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
|
||||||
|
|
||||||
* nis/Makefile: Add nis-initgroups and compat-initgroups.
|
* nis/Makefile: Add nis-initgroups and compat-initgroups.
|
||||||
|
26
Makefile
26
Makefile
@ -284,3 +284,29 @@ iconvdata/%:
|
|||||||
# need the only-MD5 based one as well.
|
# need the only-MD5 based one as well.
|
||||||
md5-crypt/libmd5crypt:
|
md5-crypt/libmd5crypt:
|
||||||
$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
|
$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
|
||||||
|
|
||||||
|
# glibc 2.0 contains some header files which aren't used with glibc 2.1
|
||||||
|
# anymore.
|
||||||
|
# These rules should remove those headers
|
||||||
|
ifeq (,$(install_root))
|
||||||
|
ifeq ($(old-glibc-headers),yes)
|
||||||
|
install: remove-old-headers
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
|
||||||
|
errnos.h fcntlbits.h huge_val.h ioctl-types.h \
|
||||||
|
ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
|
||||||
|
mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
|
||||||
|
posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
|
||||||
|
selectbits.h semaphorebits.h sigaction.h sigcontext.h \
|
||||||
|
signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
|
||||||
|
statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
|
||||||
|
syscall-list.h termbits.h timebits.h ustatbits.h \
|
||||||
|
utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
|
||||||
|
xopen_lim.h gnu/types.h sys/ipc_buf.h \
|
||||||
|
sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
|
||||||
|
sys/shm_buf.h sys/socketcall.h
|
||||||
|
|
||||||
|
remove-old-headers:
|
||||||
|
rm -f $(addprefix $(inst_includedir)/, $(headers2_0))
|
||||||
|
@ -35,6 +35,7 @@ elf = @elf@
|
|||||||
have-initfini = @libc_cv_have_initfini@
|
have-initfini = @libc_cv_have_initfini@
|
||||||
need-nopic-initfini = @nopic_initfini@
|
need-nopic-initfini = @nopic_initfini@
|
||||||
with-cvs = @with_cvs@
|
with-cvs = @with_cvs@
|
||||||
|
old-glibc-headers = @old_glibc_headers@
|
||||||
|
|
||||||
versioning = @VERSIONING@
|
versioning = @VERSIONING@
|
||||||
no-whole-archive = @no_whole_archive@
|
no-whole-archive = @no_whole_archive@
|
||||||
|
29
configure
vendored
29
configure
vendored
@ -2795,17 +2795,21 @@ default) stdio=stdio ;;
|
|||||||
esac
|
esac
|
||||||
echo "$ac_t""$stdio" 1>&6
|
echo "$ac_t""$stdio" 1>&6
|
||||||
|
|
||||||
echo $ac_n "checking ldap selection""... $ac_c" 1>&6
|
# Test for old glibc 2.0.x headers so that they can be removed properly
|
||||||
echo "configure:2800: checking ldap selection" >&5
|
# Search only in includedir.
|
||||||
|
echo $ac_n "checking for old glibc 2.0.x headers""... $ac_c" 1>&6
|
||||||
case $add_ons in
|
echo "configure:2802: checking for old glibc 2.0.x headers" >&5
|
||||||
*ldap*)
|
if eval test -e "${includedir}/elfclass.h" -a -e "${includedir}/fcntlbits.h"
|
||||||
ldap=yes
|
then
|
||||||
LDAP=ldap ;;
|
old_glibc_headers=yes
|
||||||
*) ldap=no
|
else
|
||||||
LDAP= ;;
|
old_glibc_headers=no
|
||||||
esac
|
fi
|
||||||
echo "$ac_t""$ldap" 1>&6
|
echo "$ac_t""$old_glibc_headers" 1>&6
|
||||||
|
if test ${old_glibc_headers} = yes; then
|
||||||
|
echo "configure: warning: *** During \"make install\" old headers from glibc 2.0.x will" 1>&2
|
||||||
|
echo "configure: warning: *** be removed." 1>&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2847,7 +2851,7 @@ if test $shared = default; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6
|
echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6
|
||||||
echo "configure:2851: checking whether -fPIC is default" >&5
|
echo "configure:2855: checking whether -fPIC is default" >&5
|
||||||
if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
@ -3060,7 +3064,6 @@ s%@uname_sysname@%$uname_sysname%g
|
|||||||
s%@uname_release@%$uname_release%g
|
s%@uname_release@%$uname_release%g
|
||||||
s%@uname_version@%$uname_version%g
|
s%@uname_version@%$uname_version%g
|
||||||
s%@stdio@%$stdio%g
|
s%@stdio@%$stdio%g
|
||||||
s%@LDAP@%$LDAP%g
|
|
||||||
s%@libc_cv_slibdir@%$libc_cv_slibdir%g
|
s%@libc_cv_slibdir@%$libc_cv_slibdir%g
|
||||||
s%@libc_cv_sysconfdir@%$libc_cv_sysconfdir%g
|
s%@libc_cv_sysconfdir@%$libc_cv_sysconfdir%g
|
||||||
s%@libc_cv_rootsbindir@%$libc_cv_rootsbindir%g
|
s%@libc_cv_rootsbindir@%$libc_cv_rootsbindir%g
|
||||||
|
24
configure.in
24
configure.in
@ -1101,16 +1101,20 @@ default) stdio=stdio ;;
|
|||||||
esac
|
esac
|
||||||
AC_MSG_RESULT($stdio)
|
AC_MSG_RESULT($stdio)
|
||||||
|
|
||||||
AC_MSG_CHECKING(ldap selection)
|
# Test for old glibc 2.0.x headers so that they can be removed properly
|
||||||
AC_SUBST(LDAP)
|
# Search only in includedir.
|
||||||
case $add_ons in
|
AC_MSG_CHECKING(for old glibc 2.0.x headers)
|
||||||
*ldap*)
|
if eval test -e "${includedir}/elfclass.h" -a -e "${includedir}/fcntlbits.h"
|
||||||
ldap=yes
|
then
|
||||||
LDAP=ldap ;;
|
old_glibc_headers=yes
|
||||||
*) ldap=no
|
else
|
||||||
LDAP= ;;
|
old_glibc_headers=no
|
||||||
esac
|
fi
|
||||||
AC_MSG_RESULT($ldap)
|
AC_MSG_RESULT($old_glibc_headers)
|
||||||
|
if test ${old_glibc_headers} = yes; then
|
||||||
|
AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
|
||||||
|
AC_MSG_WARN(*** be removed.)
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST(libc_cv_slibdir)
|
AC_SUBST(libc_cv_slibdir)
|
||||||
AC_SUBST(libc_cv_sysconfdir)
|
AC_SUBST(libc_cv_sysconfdir)
|
||||||
|
@ -87,7 +87,7 @@ $(objpfx)%.ir: $(objpfx)%.uh $(objpfx)%.h
|
|||||||
{ printf \"$*-calls += %s\\n\", \$$3 }" $< ;\
|
{ printf \"$*-calls += %s\\n\", \$$3 }" $< ;\
|
||||||
echo '$$($*-calls:%=$$(objpfx)R\%C_%.c): $$(objpfx)$*.ustamp ;';\
|
echo '$$($*-calls:%=$$(objpfx)R\%C_%.c): $$(objpfx)$*.ustamp ;';\
|
||||||
) > $@-new
|
) > $@-new
|
||||||
mv $@-new $@
|
mv -f $@-new $@
|
||||||
vpath Machrules ../mach # Find ourselves.
|
vpath Machrules ../mach # Find ourselves.
|
||||||
|
|
||||||
ifndef transform-user-stub-output
|
ifndef transform-user-stub-output
|
||||||
@ -161,7 +161,7 @@ $(objpfx)%.h: $(objpfx)%.__h $(objpfx)%.uh
|
|||||||
# The last line of foo.__h is "#endif _foo_user_".
|
# The last line of foo.__h is "#endif _foo_user_".
|
||||||
# The first two lines of foo.uh are "#ifndef _foo_user_"/"#define _foo_user_".
|
# The first two lines of foo.uh are "#ifndef _foo_user_"/"#define _foo_user_".
|
||||||
(sed -e '$$d' $<; sed -e '1,2d' $(word 2,$^)) > $@-new
|
(sed -e '$$d' $<; sed -e '1,2d' $(word 2,$^)) > $@-new
|
||||||
mv $@-new $@
|
mv -f $@-new $@
|
||||||
|
|
||||||
interface-routines := $(foreach if,$(user-interfaces), \
|
interface-routines := $(foreach if,$(user-interfaces), \
|
||||||
$(addprefix RPC_,$($(if)-calls))) \
|
$(addprefix RPC_,$($(if)-calls))) \
|
||||||
|
@ -77,7 +77,7 @@ $(objpfx)mach-syscalls.mk: syscalls.awk Makefile
|
|||||||
sed -n -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\
|
sed -n -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\
|
||||||
| $(AWK) -f $< > $@-new
|
| $(AWK) -f $< > $@-new
|
||||||
cat $@-dep >> $@-new; rm -f $@-dep
|
cat $@-dep >> $@-new; rm -f $@-dep
|
||||||
mv $@-new $@
|
mv -f $@-new $@
|
||||||
generated += mach-syscalls.mk
|
generated += mach-syscalls.mk
|
||||||
|
|
||||||
ifndef mach-syscalls
|
ifndef mach-syscalls
|
||||||
@ -89,7 +89,7 @@ $(mach-syscalls:%=$(objpfx)%.S): $(objpfx)%.S: $(objpfx)mach-syscalls.mk
|
|||||||
(echo '#include <sysdep.h>'; \
|
(echo '#include <sysdep.h>'; \
|
||||||
echo 'kernel_trap(__$*,$(sysno-$*),$(nargs-$*))'; \
|
echo 'kernel_trap(__$*,$(sysno-$*),$(nargs-$*))'; \
|
||||||
echo 'weak_alias (__$*, $*)') > $@-new
|
echo 'weak_alias (__$*, $*)') > $@-new
|
||||||
mv $@-new $@
|
mv -f $@-new $@
|
||||||
generated += $(mach-syscalls:=.S)
|
generated += $(mach-syscalls:=.S)
|
||||||
endif # mach-syscalls
|
endif # mach-syscalls
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ $(mach-shortcuts:%=$(objpfx)%.c): $(objpfx)%.c: shortcut.awk \
|
|||||||
$(objpfx)RPC_%_rpc.c
|
$(objpfx)RPC_%_rpc.c
|
||||||
$(AWK) -v alias=$* -v call=__$* -v rpc=__$*_rpc \
|
$(AWK) -v alias=$* -v call=__$* -v rpc=__$*_rpc \
|
||||||
-v syscall=__syscall_$* -f $^ > $@-new
|
-v syscall=__syscall_$* -f $^ > $@-new
|
||||||
mv $@-new $@
|
mv -f $@-new $@
|
||||||
generated += $(mach-shortcuts:%=%.c)
|
generated += $(mach-shortcuts:%=%.c)
|
||||||
endif # mach-shortcuts
|
endif # mach-shortcuts
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ $(objpfx)mach-shortcuts.h: $(objpfx)mach/mach_interface.h \
|
|||||||
cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
|
cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
|
||||||
| grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
|
| grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
|
||||||
| sed 's/_rpc//g' | tr @ \\012 > $@-new
|
| sed 's/_rpc//g' | tr @ \\012 > $@-new
|
||||||
mv $@-new $@
|
mv -f $@-new $@
|
||||||
generated += mach-shortcuts.h
|
generated += mach-shortcuts.h
|
||||||
|
|
||||||
before-compile += $(objpfx)mach-shortcuts.h
|
before-compile += $(objpfx)mach-shortcuts.h
|
||||||
@ -149,4 +149,4 @@ generated += errsystems.c
|
|||||||
$(objpfx)errsystems.c: errsystems.awk err_*.sub \
|
$(objpfx)errsystems.c: errsystems.awk err_*.sub \
|
||||||
$(wildcard $(addsuffix /err_*.sub,$(+sysdep_dirs)))
|
$(wildcard $(addsuffix /err_*.sub,$(+sysdep_dirs)))
|
||||||
$(AWK) -v subsys='$(filter-out $<,$^)' -f $^ > $@.n
|
$(AWK) -v subsys='$(filter-out $<,$^)' -f $^ > $@.n
|
||||||
mv $@.n $@
|
mv -f $@.n $@
|
||||||
|
@ -22,6 +22,7 @@ descriptor is and how to open a file descriptor for a terminal device.
|
|||||||
* Line Control:: Sending break sequences, clearing
|
* Line Control:: Sending break sequences, clearing
|
||||||
terminal buffers @dots{}
|
terminal buffers @dots{}
|
||||||
* Noncanon Example:: How to read single characters without echo.
|
* Noncanon Example:: How to read single characters without echo.
|
||||||
|
* Pseudo-Terminals:: How to open a pseudo-terminal.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Is It a Terminal
|
@node Is It a Terminal
|
||||||
@ -35,14 +36,14 @@ descriptor is associated with a terminal by using the @code{isatty}
|
|||||||
function.
|
function.
|
||||||
|
|
||||||
@pindex unistd.h
|
@pindex unistd.h
|
||||||
Prototypes for both @code{isatty} and @code{ttyname} are declared in
|
Prototypes for the functions in this section are declared in the header
|
||||||
the header file @file{unistd.h}.
|
file @file{unistd.h}.
|
||||||
|
|
||||||
@comment unistd.h
|
@comment unistd.h
|
||||||
@comment POSIX.1
|
@comment POSIX.1
|
||||||
@deftypefun int isatty (int @var{filedes})
|
@deftypefun int isatty (int @var{filedes})
|
||||||
This function returns @code{1} if @var{filedes} is a file descriptor
|
This function returns @code{1} if @var{filedes} is a file descriptor
|
||||||
associated with an open terminal device, and @code{0} otherwise.
|
associated with an open terminal device, and @math{0} otherwise.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
If a file descriptor is associated with a terminal, you can get its
|
If a file descriptor is associated with a terminal, you can get its
|
||||||
@ -59,6 +60,30 @@ the terminal file. The value is a null pointer if the file descriptor
|
|||||||
isn't associated with a terminal, or the file name cannot be determined.
|
isn't associated with a terminal, or the file name cannot be determined.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment unistd.h
|
||||||
|
@comment POSIX.1
|
||||||
|
@deftypefun int ttyname_r (int @var{filedes}, char *@var{buf}, size_t @var{len})
|
||||||
|
The @code{ttyname_r} function is similar to the @code{ttyname} function
|
||||||
|
except that it places its result into the user-specified buffer starting
|
||||||
|
at @var{buf} with length @var{len}.
|
||||||
|
|
||||||
|
The normal return value from @code{ttyname_r} is @math{0}. Otherwise an
|
||||||
|
error number is returned to indicate the error. The following
|
||||||
|
@code{errno} error conditions are defined for this function:
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
@item EBADF
|
||||||
|
The @var{filedes} argument is not a valid file descriptor.
|
||||||
|
|
||||||
|
@item ENOTTY
|
||||||
|
The @var{filedes} is not associated with a terminal.
|
||||||
|
|
||||||
|
@item ERANGE
|
||||||
|
The buffer length @var{len} is too small to store the string to be
|
||||||
|
returned.
|
||||||
|
@end table
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
@node I/O Queues
|
@node I/O Queues
|
||||||
@section I/O Queues
|
@section I/O Queues
|
||||||
|
|
||||||
@ -237,7 +262,7 @@ This function is used to examine the attributes of the terminal
|
|||||||
device with file descriptor @var{filedes}. The attributes are returned
|
device with file descriptor @var{filedes}. The attributes are returned
|
||||||
in the structure that @var{termios-p} points to.
|
in the structure that @var{termios-p} points to.
|
||||||
|
|
||||||
If successful, @code{tcgetattr} returns @code{0}. A return value of @code{-1}
|
If successful, @code{tcgetattr} returns @math{0}. A return value of @math{-1}
|
||||||
indicates an error. The following @code{errno} error conditions are
|
indicates an error. The following @code{errno} error conditions are
|
||||||
defined for this function:
|
defined for this function:
|
||||||
|
|
||||||
@ -302,8 +327,8 @@ write to the terminal. The exception is if the calling process itself
|
|||||||
is ignoring or blocking @code{SIGTTOU} signals, in which case the
|
is ignoring or blocking @code{SIGTTOU} signals, in which case the
|
||||||
operation is performed and no signal is sent. @xref{Job Control}.
|
operation is performed and no signal is sent. @xref{Job Control}.
|
||||||
|
|
||||||
If successful, @code{tcsetattr} returns @code{0}. A return value of
|
If successful, @code{tcsetattr} returns @math{0}. A return value of
|
||||||
@code{-1} indicates an error. The following @code{errno} error
|
@math{-1} indicates an error. The following @code{errno} error
|
||||||
conditions are defined for this function:
|
conditions are defined for this function:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@ -997,27 +1022,27 @@ This function returns the input line speed stored in the structure
|
|||||||
@comment POSIX.1
|
@comment POSIX.1
|
||||||
@deftypefun int cfsetospeed (struct termios *@var{termios-p}, speed_t @var{speed})
|
@deftypefun int cfsetospeed (struct termios *@var{termios-p}, speed_t @var{speed})
|
||||||
This function stores @var{speed} in @code{*@var{termios-p}} as the output
|
This function stores @var{speed} in @code{*@var{termios-p}} as the output
|
||||||
speed. The normal return value is @code{0}; a value of @code{-1}
|
speed. The normal return value is @math{0}; a value of @math{-1}
|
||||||
indicates an error. If @var{speed} is not a speed, @code{cfsetospeed}
|
indicates an error. If @var{speed} is not a speed, @code{cfsetospeed}
|
||||||
returns @code{-1}.
|
returns @math{-1}.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@comment termios.h
|
@comment termios.h
|
||||||
@comment POSIX.1
|
@comment POSIX.1
|
||||||
@deftypefun int cfsetispeed (struct termios *@var{termios-p}, speed_t @var{speed})
|
@deftypefun int cfsetispeed (struct termios *@var{termios-p}, speed_t @var{speed})
|
||||||
This function stores @var{speed} in @code{*@var{termios-p}} as the input
|
This function stores @var{speed} in @code{*@var{termios-p}} as the input
|
||||||
speed. The normal return value is @code{0}; a value of @code{-1}
|
speed. The normal return value is @math{0}; a value of @math{-1}
|
||||||
indicates an error. If @var{speed} is not a speed, @code{cfsetospeed}
|
indicates an error. If @var{speed} is not a speed, @code{cfsetospeed}
|
||||||
returns @code{-1}.
|
returns @math{-1}.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@comment termios.h
|
@comment termios.h
|
||||||
@comment BSD
|
@comment BSD
|
||||||
@deftypefun int cfsetspeed (struct termios *@var{termios-p}, speed_t @var{speed})
|
@deftypefun int cfsetspeed (struct termios *@var{termios-p}, speed_t @var{speed})
|
||||||
This function stores @var{speed} in @code{*@var{termios-p}} as both the
|
This function stores @var{speed} in @code{*@var{termios-p}} as both the
|
||||||
input and output speeds. The normal return value is @code{0}; a value
|
input and output speeds. The normal return value is @math{0}; a value
|
||||||
of @code{-1} indicates an error. If @var{speed} is not a speed,
|
of @math{-1} indicates an error. If @var{speed} is not a speed,
|
||||||
@code{cfsetspeed} returns @code{-1}. This function is an extension in
|
@code{cfsetspeed} returns @math{-1}. This function is an extension in
|
||||||
4.4 BSD.
|
4.4 BSD.
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@ -1035,7 +1060,7 @@ will succeed. But they do not check that a particular hardware device
|
|||||||
can actually support the specified speeds---in fact, they don't know
|
can actually support the specified speeds---in fact, they don't know
|
||||||
which device you plan to set the speed for. If you use @code{tcsetattr}
|
which device you plan to set the speed for. If you use @code{tcsetattr}
|
||||||
to set the speed of a particular device to a value that it cannot
|
to set the speed of a particular device to a value that it cannot
|
||||||
handle, @code{tcsetattr} returns @code{-1}.
|
handle, @code{tcsetattr} returns @math{-1}.
|
||||||
|
|
||||||
@strong{Portability note:} In the GNU library, the functions above
|
@strong{Portability note:} In the GNU library, the functions above
|
||||||
accept speeds measured in bits per second as input, and return speed
|
accept speeds measured in bits per second as input, and return speed
|
||||||
@ -1629,7 +1654,7 @@ This function does nothing if the terminal is not an asynchronous serial
|
|||||||
data port.
|
data port.
|
||||||
|
|
||||||
The return value is normally zero. In the event of an error, a value
|
The return value is normally zero. In the event of an error, a value
|
||||||
of @code{-1} is returned. The following @code{errno} error conditions
|
of @math{-1} is returned. The following @code{errno} error conditions
|
||||||
are defined for this function:
|
are defined for this function:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@ -1659,7 +1684,7 @@ protected using cancelation handlers.
|
|||||||
@c ref pthread_cleanup_push / pthread_cleanup_pop
|
@c ref pthread_cleanup_push / pthread_cleanup_pop
|
||||||
|
|
||||||
The return value is normally zero. In the event of an error, a value
|
The return value is normally zero. In the event of an error, a value
|
||||||
of @code{-1} is returned. The following @code{errno} error conditions
|
of @math{-1} is returned. The following @code{errno} error conditions
|
||||||
are defined for this function:
|
are defined for this function:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@ -1705,7 +1730,7 @@ Clear both queued input and output.
|
|||||||
@end table
|
@end table
|
||||||
|
|
||||||
The return value is normally zero. In the event of an error, a value
|
The return value is normally zero. In the event of an error, a value
|
||||||
of @code{-1} is returned. The following @code{errno} error conditions
|
of @math{-1} is returned. The following @code{errno} error conditions
|
||||||
are defined for this function:
|
are defined for this function:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@ -1759,7 +1784,7 @@ For more information about the STOP and START characters, see @ref{Special
|
|||||||
Characters}.
|
Characters}.
|
||||||
|
|
||||||
The return value is normally zero. In the event of an error, a value
|
The return value is normally zero. In the event of an error, a value
|
||||||
of @code{-1} is returned. The following @code{errno} error conditions
|
of @math{-1} is returned. The following @code{errno} error conditions
|
||||||
are defined for this function:
|
are defined for this function:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@ -1805,3 +1830,231 @@ a process is stopped or continued; see @ref{Job Control}. But some
|
|||||||
existing shells do not actually do this, so you may wish to establish
|
existing shells do not actually do this, so you may wish to establish
|
||||||
handlers for job control signals that reset terminal modes. The above
|
handlers for job control signals that reset terminal modes. The above
|
||||||
example does so.
|
example does so.
|
||||||
|
|
||||||
|
|
||||||
|
@node Pseudo-Terminals
|
||||||
|
@section Pseudo-Terminals
|
||||||
|
@cindex pseudo-terminals
|
||||||
|
|
||||||
|
A @dfn{pseudo-terminal} is a special interprocess communication channel
|
||||||
|
that acts like a terminal. On one end of the channel is called the
|
||||||
|
@dfn{master} side or @dfn{master pseudo-terminal device}, the other side
|
||||||
|
is called the @dfn{slave} side. Data written to the the master side is
|
||||||
|
received by the slave side as if it was the result of a user typing at
|
||||||
|
an ordinary terminal, and data written to the slave side is sent to the
|
||||||
|
master side as if it was written on an ordinary terminal.
|
||||||
|
|
||||||
|
Pseudo terminals are the way programs like @code{xterm} and @code{emacs}
|
||||||
|
implement their terminal emulation functionality.
|
||||||
|
|
||||||
|
@menu
|
||||||
|
* Allocation:: Allocating a pseudo terminal.
|
||||||
|
* Pseudo-Terminal Pairs:: How to open both sides of a
|
||||||
|
pseudo-terminal in a single operation.
|
||||||
|
@end menu
|
||||||
|
|
||||||
|
@node Allocation
|
||||||
|
@subsection Allocating Pseudo-Terminals
|
||||||
|
@cindex allocating pseudo-terminals
|
||||||
|
|
||||||
|
@pindex stdlib.h
|
||||||
|
This subsection describes functions for allocating a pseudo-terminals,
|
||||||
|
and for making this pseudo-terminal available for actual use. These
|
||||||
|
functions are declared in the header file @file{stdlib.h}.
|
||||||
|
|
||||||
|
@comment stdlib.h
|
||||||
|
@comment GNU
|
||||||
|
@deftypefun int getpt (void)
|
||||||
|
The @code{getpt} function returns a new file descriptor for the next
|
||||||
|
available master pseudo-terminal. The normal return value from
|
||||||
|
@code{getpt} is a non-negative integer file descriptor. In the case of
|
||||||
|
an error, a value of @math{-1} is returned instead. The following
|
||||||
|
@code{errno} conditions are defined for this function:
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
@item ENFILE
|
||||||
|
There are no master pseudo-terminals available.
|
||||||
|
@end table
|
||||||
|
|
||||||
|
This function is a GNU extension.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment stdlib.h
|
||||||
|
@comment SVID, XPG4.2
|
||||||
|
@deftypefun int grantpt (int @var{filedes})
|
||||||
|
The @code{grantpt} function changes the ownership and access permission
|
||||||
|
of the slave pseudo-terminal device corresponding to the master
|
||||||
|
pseudo-terminal device associated with the file descriptor
|
||||||
|
@var{filedes}. The owner is set from the real user ID of the calling
|
||||||
|
process (@pxref{Process Persona}), and the group is set to a special
|
||||||
|
group (typically @dfn{tty}) or from the real group ID of the calling
|
||||||
|
process. The access permission is set such that the file is both
|
||||||
|
readable and writable by the owner and only writable by the group.
|
||||||
|
|
||||||
|
On some systems this function is implemented by invoking a special
|
||||||
|
@code{setuid} root program (@pxref{How Change Persona}). As a
|
||||||
|
consequence, installing a signal handler for the @code{SIGCHLD} signal
|
||||||
|
(@pxref{Job Control Signals}) may interfere with a call to
|
||||||
|
@code{grantpt}.
|
||||||
|
|
||||||
|
The normal return value from @code{grantpt} is @math{0}; a value of
|
||||||
|
@math{-1} is returned in case of failure. The following @code{errno}
|
||||||
|
error conditions are defined for this function:
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
@item EBADF
|
||||||
|
The @var{filedes} argument is not a valid file descriptor.
|
||||||
|
|
||||||
|
@item ENINVAL
|
||||||
|
The @var{filedes} argument is not associated with a master pseudo-terminal
|
||||||
|
device.
|
||||||
|
|
||||||
|
@item EACCESS
|
||||||
|
The slave pseudo-terminal device corresponding to the master associated
|
||||||
|
with @var{filedes} could not be accessed.
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment stdlib.h
|
||||||
|
@comment SVID, XPG4.2
|
||||||
|
@deftypefun int unlockpt (int @var{filedes})
|
||||||
|
The @code{unlockpt} function unlocks the slave pseudo-terminal device
|
||||||
|
corresponding to the master pseudo-terminal device associated with the
|
||||||
|
file descriptor @var{filedes}. On many systems, the slave can only be
|
||||||
|
opened after unlocking, so portable applications should always call
|
||||||
|
@code{unlockpt} before trying to open the slave.
|
||||||
|
|
||||||
|
The normal return value from @code{unlockpt} is @math{0}; a value of
|
||||||
|
@math{-1} is returned in case of failure. The following @code{errno}
|
||||||
|
error conditions are defined for this function:
|
||||||
|
|
||||||
|
@table @code
|
||||||
|
@item EBADF
|
||||||
|
The @var{filedes} argument is not a valid file descriptor.
|
||||||
|
|
||||||
|
@item EINVAL
|
||||||
|
The @var{filedes} argument is not associated with a master pseudo-terminal
|
||||||
|
device.
|
||||||
|
@end table
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment stdlib.h
|
||||||
|
@comment SVID, XPG4.2
|
||||||
|
@deftypefun {char *} ptsname (int @var{filedes})
|
||||||
|
If the file descriptor @var{filedes} is associated with a
|
||||||
|
master pseudo-terminal device, the @code{ptsname} function returns a
|
||||||
|
pointer to a statically-allocated, null-terminated string containing the
|
||||||
|
file name of the associated slave pseudo-terminal file. This string
|
||||||
|
might be overwritten by subsequent calls to @code{ptsname}.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment stdlib.h
|
||||||
|
@comment GNU
|
||||||
|
@deftypefun int ptsname_r (int @var{filedes}, char *@var{buf}, size_t @var{len})
|
||||||
|
The @code{ptsname_r} function is similar to the @code{ptsname} function
|
||||||
|
except that it places its result into the user-specified buffer starting
|
||||||
|
at @var{buf} with length @var{len}.
|
||||||
|
|
||||||
|
This function is a GNU extension.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@strong{Portability Note:} On @w{System V} derived systems, the file
|
||||||
|
returned by the @code{ptsname} and @code{ptsname_r} functions may be
|
||||||
|
STREAMS-based, and therefore require additional processing after opening
|
||||||
|
before it actually behaves as a pseudo terminal.
|
||||||
|
@c FIXME: xref STREAMS
|
||||||
|
|
||||||
|
Typical usage of these functions is illustrated by the following example:
|
||||||
|
@smallexample
|
||||||
|
int
|
||||||
|
open_pty_pair (int *amaster, int *aslave)
|
||||||
|
@{
|
||||||
|
int master, slave;
|
||||||
|
char *name
|
||||||
|
|
||||||
|
master = getpt ();
|
||||||
|
if (master < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (grantpt (master) < 0 || unlockpt (master) < 0)
|
||||||
|
goto close_master;
|
||||||
|
name = ptsname (master);
|
||||||
|
if (name == NULL)
|
||||||
|
goto close_master;
|
||||||
|
|
||||||
|
slave open (name, O_RDWR);
|
||||||
|
if (slave == -1)
|
||||||
|
goto close_master;
|
||||||
|
|
||||||
|
if (isastream (slave))
|
||||||
|
@{
|
||||||
|
if (ioctl (slave, I_PUSH, "ptem") < 0
|
||||||
|
|| ioctl (slave, I_PUSH, "ldterm") < 0)
|
||||||
|
goto close_slave;
|
||||||
|
@}
|
||||||
|
|
||||||
|
*amaster = master;
|
||||||
|
*aslave = slave;
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
close_slave:
|
||||||
|
close (slave);
|
||||||
|
|
||||||
|
close_master:
|
||||||
|
close (master);
|
||||||
|
return 0;
|
||||||
|
@}
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
|
@node Pseudo-Terminal Pairs
|
||||||
|
@subsection Opening a Pseudo-Terminal Pair
|
||||||
|
@cindex opening a pseudo-terminal pair
|
||||||
|
|
||||||
|
These functions, derived from BSD, are available in the separate
|
||||||
|
@file{libutil} library, and declared in @file{pty.h}.
|
||||||
|
|
||||||
|
@comment pty.h
|
||||||
|
@comment BSD
|
||||||
|
@deftypefun int openpty (int *@var{amaster}, int *@var{aslave}, char *@var{name}, struct termios *@var{termp}, struct winsize *@var{winp})
|
||||||
|
This function allocates and opens a pseudo-terminal pair, returning the
|
||||||
|
file descriptor for the master in @var{*amaster}, and the file
|
||||||
|
descriptor for the slave in @var{*aslave}. If the argument @var{name}
|
||||||
|
is not a null pointer, the name file name of the slave pseudo-terminal
|
||||||
|
device is stored in @code{*name}. If @var{termp} is not a null pointer,
|
||||||
|
the terminal attributes of the slave are set to the ones specified in
|
||||||
|
the structure that @var{termp} points to (@pxref{Terminal Modes}).
|
||||||
|
Likewise, if the @var{winp} is not a null pointer, the screen size of
|
||||||
|
the slave is set to the values specified in the structure that
|
||||||
|
@var{winp} points to.
|
||||||
|
|
||||||
|
The normal return value from @code{openpty} is @math{0}; a value of
|
||||||
|
@math{-1} is returned in case of failure.
|
||||||
|
|
||||||
|
@strong{Warning:} Using the @code{openpty} with @var{name} not set to
|
||||||
|
@code{NULL} is @strong{very dangerous} because it provides no protection
|
||||||
|
against overflowing the string @var{name}. You should use the
|
||||||
|
@code{ttyname} function on the file descriptor returned in @var{*slave}
|
||||||
|
to find out the file name of the slave pseudo-terminal device instead.
|
||||||
|
@end deftypefun
|
||||||
|
|
||||||
|
@comment pty.h
|
||||||
|
@comment BSD
|
||||||
|
@deftypefun int forkpty (int *@var{amaster}, char *@var{name}, struct termios *@var{termp}, struct winsize *@var{winp})
|
||||||
|
This function is similar to the @code{openpty} function, but in
|
||||||
|
addition, forks creates a new process (@pxref{Creating a Process}) and
|
||||||
|
makes the newly opened slave pseudo-terminal device the controlling
|
||||||
|
terminal (@pxref{Controlling Terminal}) for the child process.
|
||||||
|
|
||||||
|
If the operation is successful, there are then both parent and child
|
||||||
|
processes and both see @code{forkpty} return, but with different values:
|
||||||
|
it returns a value of @math{0} in the child process and returns the child's
|
||||||
|
process ID in the parent process.
|
||||||
|
|
||||||
|
If the allocation of a pseudo-terminal pair or the process creation
|
||||||
|
failed, @code{forkpty} returns a value of @math{-1} in the parent
|
||||||
|
process.
|
||||||
|
|
||||||
|
@strong{Warning:} The @code{forkpty} function has the same problems with
|
||||||
|
respect to the @var{name} argument as @code{openpty}.
|
||||||
|
@end deftypefun
|
||||||
|
@ -29,8 +29,9 @@ nis_add (const_nis_name name, const nis_object *obj2)
|
|||||||
nis_result *res;
|
nis_result *res;
|
||||||
nis_error status;
|
nis_error status;
|
||||||
struct ns_request req;
|
struct ns_request req;
|
||||||
char buf1 [strlen (name) + 20];
|
size_t namelen = strlen (name);
|
||||||
char buf4 [strlen (name) + 20];
|
char buf1 [namelen + 20];
|
||||||
|
char buf4 [namelen + 20];
|
||||||
|
|
||||||
res = calloc (1, sizeof (nis_result));
|
res = calloc (1, sizeof (nis_result));
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
@ -40,13 +41,13 @@ nis_add (const_nis_name name, const nis_object *obj2)
|
|||||||
|
|
||||||
memcpy (&obj, obj2, sizeof (nis_object));
|
memcpy (&obj, obj2, sizeof (nis_object));
|
||||||
|
|
||||||
if (obj.zo_name == NULL || strlen (obj.zo_name) == 0)
|
if (obj.zo_name == NULL || obj.zo_name[0] == '\0')
|
||||||
obj.zo_name = nis_leaf_of_r (name, buf1, sizeof (buf1));
|
obj.zo_name = nis_leaf_of_r (name, buf1, sizeof (buf1));
|
||||||
|
|
||||||
if (obj.zo_owner == NULL || strlen (obj.zo_owner) == 0)
|
if (obj.zo_owner == NULL || obj.zo_owner[0] == '\0')
|
||||||
obj.zo_owner = nis_local_principal ();
|
obj.zo_owner = nis_local_principal ();
|
||||||
|
|
||||||
if (obj.zo_group == NULL || strlen (obj.zo_group) == 0)
|
if (obj.zo_group == NULL || obj.zo_group[0] == '\0')
|
||||||
obj.zo_group = nis_local_group ();
|
obj.zo_group = nis_local_group ();
|
||||||
|
|
||||||
obj.zo_domain = nis_domain_of_r (name, buf4, sizeof (buf4));
|
obj.zo_domain = nis_domain_of_r (name, buf4, sizeof (buf4));
|
||||||
@ -59,11 +60,11 @@ nis_add (const_nis_name name, const nis_object *obj2)
|
|||||||
}
|
}
|
||||||
req.ns_object.ns_object_len = 1;
|
req.ns_object.ns_object_len = 1;
|
||||||
|
|
||||||
if ((status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain,
|
status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain,
|
||||||
NIS_ADD, (xdrproc_t) _xdr_ns_request,
|
NIS_ADD, (xdrproc_t) _xdr_ns_request,
|
||||||
(caddr_t) &req, (xdrproc_t) _xdr_nis_result,
|
(caddr_t) &req, (xdrproc_t) _xdr_nis_result,
|
||||||
(caddr_t) res, MASTER_ONLY,
|
(caddr_t) res, MASTER_ONLY, NULL);
|
||||||
NULL)) != RPC_SUCCESS)
|
if (status != RPC_SUCCESS)
|
||||||
NIS_RES_STATUS (res) = status;
|
NIS_RES_STATUS (res) = status;
|
||||||
|
|
||||||
nis_destroy_object (req.ns_object.ns_object_val);
|
nis_destroy_object (req.ns_object.ns_object_val);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 1997 Free Software Foundation, Inc.
|
/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -23,11 +23,12 @@
|
|||||||
nis_error
|
nis_error
|
||||||
nis_addmember (const_nis_name member, const_nis_name group)
|
nis_addmember (const_nis_name member, const_nis_name group)
|
||||||
{
|
{
|
||||||
if (group != NULL && strlen (group) > 0)
|
if (group != NULL && group[0] != '\0')
|
||||||
{
|
{
|
||||||
char buf[strlen (group) + 14 + NIS_MAXNAMELEN];
|
size_t grouplen = strlen (group);
|
||||||
char leafbuf[strlen (group) + 2];
|
char buf[grouplen + 14 + NIS_MAXNAMELEN];
|
||||||
char domainbuf[strlen (group) + 2];
|
char leafbuf[grouplen + 2];
|
||||||
|
char domainbuf[grouplen + 2];
|
||||||
nis_result *res, *res2;
|
nis_result *res, *res2;
|
||||||
nis_error status;
|
nis_error status;
|
||||||
char *cp, *cp2;
|
char *cp, *cp2;
|
||||||
@ -35,7 +36,7 @@ nis_addmember (const_nis_name member, const_nis_name group)
|
|||||||
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
||||||
cp = stpcpy (cp, ".groups_dir");
|
cp = stpcpy (cp, ".groups_dir");
|
||||||
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
||||||
if (cp2 != NULL && strlen (cp2) > 0)
|
if (cp2 != NULL && cp2[0] != '\0')
|
||||||
{
|
{
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
stpcpy (cp, cp2);
|
stpcpy (cp, cp2);
|
||||||
|
@ -484,9 +484,10 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, u_long flags,
|
|||||||
case LOWER_NAME:
|
case LOWER_NAME:
|
||||||
{
|
{
|
||||||
directory_obj *obj;
|
directory_obj *obj;
|
||||||
char leaf [strlen (name) + 3];
|
size_t namelen = strlen (name);
|
||||||
char domain [strlen (name) + 3];
|
char leaf [namelen + 3];
|
||||||
char ndomain [strlen (name) + 3];
|
char domain [namelen + 3];
|
||||||
|
char ndomain [namelen + 3];
|
||||||
char *cp;
|
char *cp;
|
||||||
u_int run = 0;
|
u_int run = 0;
|
||||||
|
|
||||||
@ -494,7 +495,7 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, u_long flags,
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (strlen (domain) == 0)
|
if (domain[0] == '\0')
|
||||||
{
|
{
|
||||||
nis_free_directory (dir);
|
nis_free_directory (dir);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -313,7 +313,7 @@ __nis_create_callback (int (*callback) (const_nis_name, const nis_object *,
|
|||||||
#else
|
#else
|
||||||
cb->serv->pkey.n_len =0;
|
cb->serv->pkey.n_len =0;
|
||||||
cb->serv->pkey.n_bytes = NULL;
|
cb->serv->pkey.n_bytes = NULL;
|
||||||
cb->serv->key_type = NIS_PK_DH;
|
cb->serv->key_type = NIS_PK_NONE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
nis_error
|
nis_error
|
||||||
nis_creategroup (const_nis_name group, u_long flags)
|
nis_creategroup (const_nis_name group, u_long flags)
|
||||||
{
|
{
|
||||||
if (group != NULL && strlen (group) > 0)
|
if (group != NULL && group[0] != '\0')
|
||||||
{
|
{
|
||||||
char buf[strlen (group) + 50];
|
size_t grouplen = strlen (group);
|
||||||
char leafbuf[strlen (group) + 2];
|
char buf[grouplen + 50];
|
||||||
char domainbuf[strlen (group) + 2];
|
char leafbuf[grouplen + 2];
|
||||||
|
char domainbuf[grouplen + 2];
|
||||||
nis_error status;
|
nis_error status;
|
||||||
nis_result *res;
|
nis_result *res;
|
||||||
char *cp, *cp2;
|
char *cp, *cp2;
|
||||||
@ -36,7 +37,7 @@ nis_creategroup (const_nis_name group, u_long flags)
|
|||||||
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
||||||
cp = stpcpy (cp, ".groups_dir");
|
cp = stpcpy (cp, ".groups_dir");
|
||||||
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
||||||
if (cp2 != NULL && strlen (cp2) > 0)
|
if (cp2 != NULL && cp2[0] != '\0')
|
||||||
{
|
{
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
stpcpy (cp, cp2);
|
stpcpy (cp, cp2);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 1997 Free Software Foundation, Inc.
|
/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -23,11 +23,12 @@
|
|||||||
nis_error
|
nis_error
|
||||||
nis_destroygroup (const_nis_name group)
|
nis_destroygroup (const_nis_name group)
|
||||||
{
|
{
|
||||||
if (group != NULL && strlen (group) > 0)
|
if (group != NULL && group[0] != '\0')
|
||||||
{
|
{
|
||||||
char buf[strlen (group) + 50];
|
size_t grouplen = strlen (group);
|
||||||
char leafbuf[strlen (group) + 3];
|
char buf[grouplen + 50];
|
||||||
char domainbuf[strlen (group) + 3];
|
char leafbuf[grouplen + 3];
|
||||||
|
char domainbuf[grouplen + 3];
|
||||||
nis_error status;
|
nis_error status;
|
||||||
nis_result *res;
|
nis_result *res;
|
||||||
char *cp, *cp2;
|
char *cp, *cp2;
|
||||||
@ -35,7 +36,7 @@ nis_destroygroup (const_nis_name group)
|
|||||||
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
||||||
cp = stpcpy (cp, ".groups_dir");
|
cp = stpcpy (cp, ".groups_dir");
|
||||||
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
||||||
if (cp2 != NULL && strlen (cp2) > 0)
|
if (cp2 != NULL && cp2[0] != '\0')
|
||||||
{
|
{
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
stpcpy (cp, cp2);
|
stpcpy (cp, cp2);
|
||||||
|
@ -30,6 +30,7 @@ readColdStartFile (void)
|
|||||||
{
|
{
|
||||||
XDR xdrs;
|
XDR xdrs;
|
||||||
FILE *in;
|
FILE *in;
|
||||||
|
bool_t status;
|
||||||
directory_obj obj;
|
directory_obj obj;
|
||||||
|
|
||||||
in = fopen (cold_start_file, "rb");
|
in = fopen (cold_start_file, "rb");
|
||||||
@ -37,10 +38,11 @@ readColdStartFile (void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
memset (&obj, '\0', sizeof (obj));
|
memset (&obj, '\0', sizeof (obj));
|
||||||
xdrstdio_create (&xdrs, in, XDR_DECODE);
|
xdrstdio_create (&xdrs, in, XDR_DECODE);
|
||||||
if (!_xdr_directory_obj (&xdrs, &obj))
|
status = _xdr_directory_obj (&xdrs, &obj);
|
||||||
return NULL;
|
xdr_destroy (&xdrs);
|
||||||
|
fclose (in);
|
||||||
|
|
||||||
return nis_clone_directory (&obj, NULL);
|
return status ? nis_clone_directory (&obj, NULL) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
@ -48,16 +50,18 @@ writeColdStartFile (const directory_obj *obj)
|
|||||||
{
|
{
|
||||||
XDR xdrs;
|
XDR xdrs;
|
||||||
FILE *out;
|
FILE *out;
|
||||||
|
bool_t status;
|
||||||
|
|
||||||
out = fopen (cold_start_file, "wb");
|
out = fopen (cold_start_file, "wb");
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
xdrstdio_create (&xdrs, out, XDR_ENCODE);
|
xdrstdio_create (&xdrs, out, XDR_ENCODE);
|
||||||
if (!_xdr_directory_obj (&xdrs, (directory_obj *) obj))
|
status = _xdr_directory_obj (&xdrs, (directory_obj *) obj);
|
||||||
return FALSE;
|
xdr_destroy (&xdrs);
|
||||||
|
fclose (out);
|
||||||
|
|
||||||
return TRUE;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
nis_object *
|
nis_object *
|
||||||
@ -65,6 +69,7 @@ nis_read_obj (const char *name)
|
|||||||
{
|
{
|
||||||
XDR xdrs;
|
XDR xdrs;
|
||||||
FILE *in;
|
FILE *in;
|
||||||
|
bool_t status;
|
||||||
nis_object obj;
|
nis_object obj;
|
||||||
|
|
||||||
in = fopen (name, "rb");
|
in = fopen (name, "rb");
|
||||||
@ -73,10 +78,11 @@ nis_read_obj (const char *name)
|
|||||||
|
|
||||||
memset (&obj, '\0', sizeof (obj));
|
memset (&obj, '\0', sizeof (obj));
|
||||||
xdrstdio_create (&xdrs, in, XDR_DECODE);
|
xdrstdio_create (&xdrs, in, XDR_DECODE);
|
||||||
if (!_xdr_nis_object (&xdrs, &obj))
|
status =_xdr_nis_object (&xdrs, &obj);
|
||||||
return NULL;
|
xdr_destroy (&xdrs);
|
||||||
|
fclose (in);
|
||||||
|
|
||||||
return nis_clone_object (&obj, NULL);
|
return status ? nis_clone_object (&obj, NULL) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
@ -84,14 +90,16 @@ nis_write_obj (const char *name, const nis_object *obj)
|
|||||||
{
|
{
|
||||||
XDR xdrs;
|
XDR xdrs;
|
||||||
FILE *out;
|
FILE *out;
|
||||||
|
bool_t status;
|
||||||
|
|
||||||
out = fopen (name, "wb");
|
out = fopen (name, "wb");
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
xdrstdio_create (&xdrs, out, XDR_ENCODE);
|
xdrstdio_create (&xdrs, out, XDR_ENCODE);
|
||||||
if (!_xdr_nis_object (&xdrs, (nis_object *) obj))
|
status = _xdr_nis_object (&xdrs, (nis_object *) obj);
|
||||||
return FALSE;
|
xdr_destroy (&xdrs);
|
||||||
|
fclose (out);
|
||||||
|
|
||||||
return TRUE;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ __nis_findfastest (dir_binding * bind)
|
|||||||
if (strcmp (bind->server_val[i].ep.ep_val[j].family, "inet") == 0)
|
if (strcmp (bind->server_val[i].ep.ep_val[j].family, "inet") == 0)
|
||||||
if ((bind->server_val[i].ep.ep_val[j].proto == NULL) ||
|
if ((bind->server_val[i].ep.ep_val[j].proto == NULL) ||
|
||||||
(strcmp (bind->server_val[i].ep.ep_val[j].proto, "-") == 0) ||
|
(strcmp (bind->server_val[i].ep.ep_val[j].proto, "-") == 0) ||
|
||||||
(strlen (bind->server_val[i].ep.ep_val[j].proto) == 0))
|
(bind->server_val[i].ep.ep_val[j].proto[0] == '\0'))
|
||||||
{
|
{
|
||||||
sin.sin_addr.s_addr =
|
sin.sin_addr.s_addr =
|
||||||
inetstr2int (bind->server_val[i].ep.ep_val[j].uaddr);
|
inetstr2int (bind->server_val[i].ep.ep_val[j].uaddr);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 1997 Free Software Foundation, Inc.
|
/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -27,9 +27,10 @@
|
|||||||
static int
|
static int
|
||||||
internal_ismember (const_nis_name principal, const_nis_name group)
|
internal_ismember (const_nis_name principal, const_nis_name group)
|
||||||
{
|
{
|
||||||
char buf[strlen (group) + 50];
|
size_t grouplen = strlen (group);
|
||||||
char leafbuf[strlen (group) + 2];
|
char buf[grouplen + 50];
|
||||||
char domainbuf[strlen (group) + 2];
|
char leafbuf[grouplen + 2];
|
||||||
|
char domainbuf[grouplen + 2];
|
||||||
nis_result *res;
|
nis_result *res;
|
||||||
char *cp, *cp2;
|
char *cp, *cp2;
|
||||||
u_int i;
|
u_int i;
|
||||||
@ -37,7 +38,7 @@ internal_ismember (const_nis_name principal, const_nis_name group)
|
|||||||
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
||||||
cp = stpcpy (cp, ".groups_dir");
|
cp = stpcpy (cp, ".groups_dir");
|
||||||
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
||||||
if (cp2 != NULL && strlen (cp2) > 0)
|
if (cp2 != NULL && cp2[0] != '\0')
|
||||||
{
|
{
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
strcpy (cp, cp2);
|
strcpy (cp, cp2);
|
||||||
@ -117,7 +118,7 @@ internal_ismember (const_nis_name principal, const_nis_name group)
|
|||||||
bool_t
|
bool_t
|
||||||
nis_ismember (const_nis_name principal, const_nis_name group)
|
nis_ismember (const_nis_name principal, const_nis_name group)
|
||||||
{
|
{
|
||||||
if (group != NULL && strlen (group) > 0 && principal != NULL)
|
if (group != NULL && group[0] != '\0' && principal != NULL)
|
||||||
return internal_ismember (principal, group) == 1 ? TRUE : FALSE;
|
return internal_ismember (principal, group) == 1 ? TRUE : FALSE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -202,15 +202,15 @@ nis_print_directory (const directory_obj *dir)
|
|||||||
for (j = 0; j < sptr->ep.ep_len; j++)
|
for (j = 0; j < sptr->ep.ep_len; j++)
|
||||||
{
|
{
|
||||||
printf ("\t[%d] - ", j + 1);
|
printf ("\t[%d] - ", j + 1);
|
||||||
if (ptr->proto != NULL && strlen (ptr->proto) > 0)
|
if (ptr->proto != NULL && ptr->proto[0] != '\0')
|
||||||
printf ("%s, ", ptr->proto);
|
printf ("%s, ", ptr->proto);
|
||||||
else
|
else
|
||||||
printf ("-, ");
|
printf ("-, ");
|
||||||
if (ptr->family != NULL && strlen (ptr->family) > 0)
|
if (ptr->family != NULL && ptr->family[0] != '\0')
|
||||||
printf ("%s, ", ptr->family);
|
printf ("%s, ", ptr->family);
|
||||||
else
|
else
|
||||||
printf ("-, ");
|
printf ("-, ");
|
||||||
if (ptr->uaddr != NULL && strlen (ptr->uaddr) > 0)
|
if (ptr->uaddr != NULL && ptr->uaddr[0] != '\0')
|
||||||
printf ("%s\n", ptr->uaddr);
|
printf ("%s\n", ptr->uaddr);
|
||||||
else
|
else
|
||||||
fputs ("-\n", stdout);
|
fputs ("-\n", stdout);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 1997 Free Software Foundation, Inc.
|
/* Copyright (c) 1997, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
|
||||||
|
|
||||||
@ -23,11 +23,12 @@
|
|||||||
void
|
void
|
||||||
nis_print_group_entry (const_nis_name group)
|
nis_print_group_entry (const_nis_name group)
|
||||||
{
|
{
|
||||||
if (group != NULL && strlen (group) > 0)
|
if (group != NULL && group[0] != '\0')
|
||||||
{
|
{
|
||||||
char buf[strlen (group) + 50];
|
size_t grouplen = strlen (group);
|
||||||
char leafbuf[strlen (group) + 3];
|
char buf[grouplen + 50];
|
||||||
char domainbuf[strlen (group) + 3];
|
char leafbuf[grouplen + 3];
|
||||||
|
char domainbuf[grouplen + 3];
|
||||||
unsigned long mem_exp_cnt = 0, mem_imp_cnt = 0, mem_rec_cnt = 0;
|
unsigned long mem_exp_cnt = 0, mem_imp_cnt = 0, mem_rec_cnt = 0;
|
||||||
unsigned long nomem_exp_cnt = 0, nomem_imp_cnt = 0, nomem_rec_cnt = 0;
|
unsigned long nomem_exp_cnt = 0, nomem_imp_cnt = 0, nomem_rec_cnt = 0;
|
||||||
char **mem_exp, **mem_imp, **mem_rec;
|
char **mem_exp, **mem_imp, **mem_rec;
|
||||||
@ -39,7 +40,7 @@ nis_print_group_entry (const_nis_name group)
|
|||||||
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
||||||
cp = stpcpy (cp, ".groups_dir");
|
cp = stpcpy (cp, ".groups_dir");
|
||||||
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
||||||
if (cp2 != NULL && strlen (cp2) > 0)
|
if (cp2 != NULL && cp2[0] != '\0')
|
||||||
{
|
{
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
stpcpy (cp, cp2);
|
stpcpy (cp, cp2);
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
nis_error
|
nis_error
|
||||||
nis_removemember (const_nis_name member, const_nis_name group)
|
nis_removemember (const_nis_name member, const_nis_name group)
|
||||||
{
|
{
|
||||||
if (group != NULL && strlen (group) > 0)
|
if (group != NULL && group[0] != '\0')
|
||||||
{
|
{
|
||||||
char buf[strlen (group) + 14 + NIS_MAXNAMELEN];
|
size_t grouplen = strlen (group);
|
||||||
char leafbuf[strlen (group) + 2];
|
char buf[grouplen + 14 + NIS_MAXNAMELEN];
|
||||||
char domainbuf[strlen (group) + 2];
|
char leafbuf[grouplen + 2];
|
||||||
|
char domainbuf[grouplen + 2];
|
||||||
nis_name *newmem;
|
nis_name *newmem;
|
||||||
nis_result *res, *res2;
|
nis_result *res, *res2;
|
||||||
nis_error status;
|
nis_error status;
|
||||||
@ -37,7 +38,7 @@ nis_removemember (const_nis_name member, const_nis_name group)
|
|||||||
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
||||||
cp = stpcpy (cp, ".groups_dir");
|
cp = stpcpy (cp, ".groups_dir");
|
||||||
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
||||||
if (cp2 != NULL && strlen (cp2) > 0)
|
if (cp2 != NULL && cp2[0] != '\0')
|
||||||
{
|
{
|
||||||
cp = stpcpy (cp, ".");
|
cp = stpcpy (cp, ".");
|
||||||
stpcpy (cp, cp2);
|
stpcpy (cp, cp2);
|
||||||
|
@ -23,11 +23,12 @@
|
|||||||
nis_error
|
nis_error
|
||||||
nis_verifygroup (const_nis_name group)
|
nis_verifygroup (const_nis_name group)
|
||||||
{
|
{
|
||||||
if (group != NULL && strlen (group) > 0)
|
if (group != NULL && group[0] != '\0')
|
||||||
{
|
{
|
||||||
char buf[strlen (group) + 50];
|
size_t grouplen = strlen (group);
|
||||||
char leafbuf[strlen (group) + 2];
|
char buf[grouplen + 50];
|
||||||
char domainbuf[strlen (group) + 2];
|
char leafbuf[grouplen + 2];
|
||||||
|
char domainbuf[grouplen + 2];
|
||||||
nis_result *res;
|
nis_result *res;
|
||||||
nis_error status;
|
nis_error status;
|
||||||
char *cp, *cp2;
|
char *cp, *cp2;
|
||||||
@ -35,7 +36,7 @@ nis_verifygroup (const_nis_name group)
|
|||||||
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
|
||||||
cp = stpcpy (cp, ".groups_dir");
|
cp = stpcpy (cp, ".groups_dir");
|
||||||
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
|
||||||
if (cp2 != NULL && strlen (cp2) > 0)
|
if (cp2 != NULL && cp2[0] != '\0')
|
||||||
{
|
{
|
||||||
*cp++ = '.';
|
*cp++ = '.';
|
||||||
stpcpy (cp, cp2);
|
stpcpy (cp, cp2);
|
||||||
|
@ -64,7 +64,7 @@ __yp_bind (const char *domain, dom_binding **ypdb)
|
|||||||
int is_new = 0;
|
int is_new = 0;
|
||||||
int try;
|
int try;
|
||||||
|
|
||||||
if ((domain == NULL) || (strlen (domain) == 0))
|
if ((domain == NULL) || (domain[0] == '\0'))
|
||||||
return YPERR_BADARGS;
|
return YPERR_BADARGS;
|
||||||
|
|
||||||
if (ypdb != NULL)
|
if (ypdb != NULL)
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <sys/poll.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -37,10 +38,11 @@
|
|||||||
#include "dbg_log.h"
|
#include "dbg_log.h"
|
||||||
|
|
||||||
/* Socket 0 in the array is named and exported into the file namespace
|
/* Socket 0 in the array is named and exported into the file namespace
|
||||||
as a connection point for clients. */
|
as a connection point for clients. There's a one to one
|
||||||
|
correspondence between sock[i] and read_polls[i]. */
|
||||||
static int sock[MAX_NUM_CONNECTIONS];
|
static int sock[MAX_NUM_CONNECTIONS];
|
||||||
static int socks_active;
|
static int socks_active;
|
||||||
static fd_set read_set;
|
static struct pollfd read_polls[MAX_NUM_CONNECTIONS];
|
||||||
static pthread_mutex_t sock_lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t sock_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
|
|
||||||
@ -63,6 +65,7 @@ close_sockets (void)
|
|||||||
dbg_log (_("socket [%d|%d] close: %s"), strerror (errno));
|
dbg_log (_("socket [%d|%d] close: %s"), strerror (errno));
|
||||||
|
|
||||||
sock[i] = 0;
|
sock[i] = 0;
|
||||||
|
read_polls[i].fd = -1;
|
||||||
--socks_active;
|
--socks_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,12 +82,13 @@ close_socket (int conn)
|
|||||||
|
|
||||||
close (sock[conn]);
|
close (sock[conn]);
|
||||||
sock[conn] = 0;
|
sock[conn] = 0;
|
||||||
|
read_polls[conn].fd = -1;
|
||||||
--socks_active;
|
--socks_active;
|
||||||
|
|
||||||
pthread_mutex_unlock (&sock_lock);
|
pthread_mutex_unlock (&sock_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Local rountine, assigns a socket to a new connection request. */
|
/* Local routine, assigns a socket to a new connection request. */
|
||||||
static void
|
static void
|
||||||
handle_new_connection (void)
|
handle_new_connection (void)
|
||||||
{
|
{
|
||||||
@ -107,7 +111,8 @@ handle_new_connection (void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
++socks_active;
|
++socks_active;
|
||||||
FD_SET (sock[i], &read_set);
|
read_polls[i].fd = sock[i];
|
||||||
|
read_polls[i].events = POLLRDNORM;
|
||||||
if (debug_flag > 2)
|
if (debug_flag > 2)
|
||||||
dbg_log (_("handle_new_connection used socket %d|%d"), i,
|
dbg_log (_("handle_new_connection used socket %d|%d"), i,
|
||||||
sock[i]);
|
sock[i]);
|
||||||
@ -127,10 +132,9 @@ handle_new_connection (void)
|
|||||||
pthread_mutex_unlock (&sock_lock);
|
pthread_mutex_unlock (&sock_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Local routine, reads a request off a socket indicated by a selectset. */
|
/* Local routine, reads a request off a socket indicated by read_polls. */
|
||||||
static int
|
static int
|
||||||
handle_new_request (fd_set read_selects, int **connp, request_header **reqp,
|
handle_new_request (int **connp, request_header **reqp, char **key)
|
||||||
char **key)
|
|
||||||
{
|
{
|
||||||
ssize_t nbytes;
|
ssize_t nbytes;
|
||||||
int i;
|
int i;
|
||||||
@ -140,7 +144,7 @@ handle_new_request (fd_set read_selects, int **connp, request_header **reqp,
|
|||||||
|
|
||||||
/* Find the descriptor. */
|
/* Find the descriptor. */
|
||||||
for (i = 1; i < MAX_NUM_CONNECTIONS; ++i)
|
for (i = 1; i < MAX_NUM_CONNECTIONS; ++i)
|
||||||
if (FD_ISSET(sock[i], &read_selects))
|
if (read_polls[i].revents & (POLLRDNORM|POLLERR))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (debug_flag > 2)
|
if (debug_flag > 2)
|
||||||
@ -158,7 +162,7 @@ handle_new_request (fd_set read_selects, int **connp, request_header **reqp,
|
|||||||
dbg_log (_("Real close socket %d|%d"), i, sock[i]);
|
dbg_log (_("Real close socket %d|%d"), i, sock[i]);
|
||||||
|
|
||||||
pthread_mutex_lock (&sock_lock);
|
pthread_mutex_lock (&sock_lock);
|
||||||
FD_CLR (sock[i], &read_set);
|
read_polls[i].fd = -1;
|
||||||
close (sock[i]);
|
close (sock[i]);
|
||||||
sock[i] = 0;
|
sock[i] = 0;
|
||||||
--socks_active;
|
--socks_active;
|
||||||
@ -191,7 +195,7 @@ handle_new_request (fd_set read_selects, int **connp, request_header **reqp,
|
|||||||
dbg_log (_("Real close socket %d|%d"), i, sock[i]);
|
dbg_log (_("Real close socket %d|%d"), i, sock[i]);
|
||||||
|
|
||||||
pthread_mutex_lock (&sock_lock);
|
pthread_mutex_lock (&sock_lock);
|
||||||
FD_CLR (sock[i], &read_set);
|
read_polls[i].fd = -1;
|
||||||
close (sock[i]);
|
close (sock[i]);
|
||||||
sock[i] = 0;
|
sock[i] = 0;
|
||||||
--socks_active;
|
--socks_active;
|
||||||
@ -223,8 +227,8 @@ handle_new_request (fd_set read_selects, int **connp, request_header **reqp,
|
|||||||
void
|
void
|
||||||
get_request (int *conn, request_header *req, char **key)
|
get_request (int *conn, request_header *req, char **key)
|
||||||
{
|
{
|
||||||
int i, nr, done = 0;
|
int done = 0;
|
||||||
fd_set read_selects;
|
int nr;
|
||||||
|
|
||||||
if (debug_flag)
|
if (debug_flag)
|
||||||
dbg_log ("get_request");
|
dbg_log ("get_request");
|
||||||
@ -233,35 +237,21 @@ get_request (int *conn, request_header *req, char **key)
|
|||||||
is read in on an existing connection. */
|
is read in on an existing connection. */
|
||||||
while (!done)
|
while (!done)
|
||||||
{
|
{
|
||||||
/* Set up the socket descriptor mask for the select.
|
/* Poll active connections. */
|
||||||
copy read_set into the local copy. */
|
nr = poll (read_polls, MAX_NUM_CONNECTIONS, -1);
|
||||||
|
|
||||||
FD_ZERO (&read_selects);
|
|
||||||
pthread_mutex_lock (&sock_lock);
|
|
||||||
for (i = 0; i < MAX_NUM_CONNECTIONS; ++i)
|
|
||||||
{
|
|
||||||
if (FD_ISSET (sock[i], &read_set))
|
|
||||||
FD_SET (sock[i], &read_selects);
|
|
||||||
}
|
|
||||||
pthread_mutex_unlock (&sock_lock);
|
|
||||||
/* Poll active connections using select(). */
|
|
||||||
nr = select (FD_SETSIZE, &read_selects, NULL, NULL, NULL);
|
|
||||||
if (nr <= 0)
|
if (nr <= 0)
|
||||||
{
|
{
|
||||||
perror (_("Select new reads"));
|
perror (_("Poll new reads"));
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
if (FD_ISSET (sock[0], &read_selects))
|
if (read_polls[0].revents & (POLLRDNORM|POLLERR))
|
||||||
/* Handle the case of a new connection request on the named socket. */
|
/* Handle the case of a new connection request on the named socket. */
|
||||||
handle_new_connection ();
|
handle_new_connection ();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Read data from client specific descriptor. */
|
/* Read data from client specific descriptor. */
|
||||||
if (handle_new_request (read_selects, &conn, &req, key) == 0)
|
if (handle_new_request (&conn, &req, key) == 0)
|
||||||
{
|
done = 1;
|
||||||
FD_CLR (sock[*conn], &read_set);
|
|
||||||
done = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} /* While not_done. */
|
} /* While not_done. */
|
||||||
}
|
}
|
||||||
@ -270,10 +260,14 @@ void
|
|||||||
init_sockets (void)
|
init_sockets (void)
|
||||||
{
|
{
|
||||||
struct sockaddr_un sock_addr;
|
struct sockaddr_un sock_addr;
|
||||||
|
int i;
|
||||||
|
|
||||||
/* Initialize the connections db. */
|
/* Initialize the connections db. */
|
||||||
socks_active = 0;
|
socks_active = 0;
|
||||||
FD_ZERO (&read_set);
|
|
||||||
|
/* Initialize the poll array. */
|
||||||
|
for (i = 0; i < MAX_NUM_CONNECTIONS; i++)
|
||||||
|
read_polls[i].fd = -1;
|
||||||
|
|
||||||
/* Create the socket. */
|
/* Create the socket. */
|
||||||
sock[0] = socket (AF_UNIX, SOCK_STREAM, 0);
|
sock[0] = socket (AF_UNIX, SOCK_STREAM, 0);
|
||||||
@ -301,7 +295,8 @@ init_sockets (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add the socket to the server's set of active sockets. */
|
/* Add the socket to the server's set of active sockets. */
|
||||||
FD_SET (sock[0], &read_set);
|
read_polls[0].fd = sock[0];
|
||||||
|
read_polls[0].events = POLLRDNORM;
|
||||||
++socks_active;
|
++socks_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
make_siglist.c signame.c signame.h
|
make_siglist.c signame.c signame.h
|
||||||
det_endian.c
|
det_endian.c
|
||||||
entry.h
|
entry.h
|
||||||
errno-loc.c.
|
errno-loc.c
|
||||||
getresgid.c
|
getresgid.c
|
||||||
getresuid.c
|
getresuid.c
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Define and initialize the `__libc_enable_secure' flag. Generic version.
|
/* Define and initialize the `__libc_enable_secure' flag. Generic version.
|
||||||
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -26,13 +26,9 @@
|
|||||||
/* Safest assumption, if somehow the initializer isn't run. */
|
/* Safest assumption, if somehow the initializer isn't run. */
|
||||||
int __libc_enable_secure = 1;
|
int __libc_enable_secure = 1;
|
||||||
|
|
||||||
/* We often need the UID. */
|
|
||||||
extern uid_t __libc_uid;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
__libc_init_secure (void)
|
__libc_init_secure (void)
|
||||||
{
|
{
|
||||||
__libc_uid = __getuid ();
|
__libc_enable_secure = (__geteuid () != __getuid ()
|
||||||
__libc_enable_secure = (__geteuid () != __libc_uid
|
|
||||||
|| __getegid () != __getgid ());
|
|| __getegid () != __getgid ());
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -16,13 +16,13 @@
|
|||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
/* Truncate the file FD refers to to LENGTH bytes. */
|
/* Truncate the file FD refers to to LENGTH bytes. */
|
||||||
int
|
int
|
||||||
ftruncate (fd, length)
|
__ftruncate (fd, length)
|
||||||
int fd;
|
int fd;
|
||||||
off_t length;
|
off_t length;
|
||||||
{
|
{
|
||||||
@ -30,5 +30,7 @@ ftruncate (fd, length)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
weak_alias (__ftruncate, ftruncate)
|
||||||
|
|
||||||
stub_warning (ftruncate)
|
stub_warning (ftruncate)
|
||||||
#include <stub-tag.h>
|
#include <stub-tag.h>
|
||||||
|
@ -253,14 +253,16 @@ extern char *alloca ();
|
|||||||
|
|
||||||
/* Some system header files erroneously define these.
|
/* Some system header files erroneously define these.
|
||||||
We want our own definitions from <glob.h> to take precedence. */
|
We want our own definitions from <glob.h> to take precedence. */
|
||||||
#undef GLOB_ERR
|
#ifndef __GNU_LIBRARY__
|
||||||
#undef GLOB_MARK
|
# undef GLOB_ERR
|
||||||
#undef GLOB_NOSORT
|
# undef GLOB_MARK
|
||||||
#undef GLOB_DOOFFS
|
# undef GLOB_NOSORT
|
||||||
#undef GLOB_NOCHECK
|
# undef GLOB_DOOFFS
|
||||||
#undef GLOB_APPEND
|
# undef GLOB_NOCHECK
|
||||||
#undef GLOB_NOESCAPE
|
# undef GLOB_APPEND
|
||||||
#undef GLOB_PERIOD
|
# undef GLOB_NOESCAPE
|
||||||
|
# undef GLOB_PERIOD
|
||||||
|
#endif
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -16,15 +16,15 @@
|
|||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <hurd.h>
|
#include <hurd.h>
|
||||||
#include <hurd/fd.h>
|
#include <hurd/fd.h>
|
||||||
|
|
||||||
/* Truncate the file FD refers to to LENGTH bytes. */
|
/* Truncate the file FD refers to to LENGTH bytes. */
|
||||||
int
|
int
|
||||||
ftruncate (fd, length)
|
__ftruncate (fd, length)
|
||||||
int fd;
|
int fd;
|
||||||
__off_t length;
|
__off_t length;
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
|
/* Copyright (C) 1991, 92, 93, 94, 95, 97, 98 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -16,15 +16,16 @@
|
|||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <hurd.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <hurd.h>
|
||||||
|
|
||||||
/* Truncate FILE_NAME to LENGTH bytes. */
|
/* Truncate FILE_NAME to LENGTH bytes. */
|
||||||
int
|
int
|
||||||
truncate (file_name, length)
|
truncate (file_name, length)
|
||||||
char *file_name;
|
const char *file_name;
|
||||||
off_t length;
|
off_t length;
|
||||||
{
|
{
|
||||||
error_t err;
|
error_t err;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -24,9 +24,8 @@
|
|||||||
|
|
||||||
extern int __syscall_rt_sigqueueinfo (int, int, siginfo_t *);
|
extern int __syscall_rt_sigqueueinfo (int, int, siginfo_t *);
|
||||||
|
|
||||||
/* These variables are used quite often in the libc code. */
|
/* This variable is used quite often in the libc code. */
|
||||||
extern pid_t __libc_pid;
|
extern pid_t __libc_pid;
|
||||||
extern uid_t __libc_uid;
|
|
||||||
|
|
||||||
|
|
||||||
/* Return any pending signal or wait for one for the given time. */
|
/* Return any pending signal or wait for one for the given time. */
|
||||||
@ -46,7 +45,7 @@ __aio_sigqueue (sig, val)
|
|||||||
__libc_pid = __getpid ();
|
__libc_pid = __getpid ();
|
||||||
info.si_pid = __libc_pid;
|
info.si_pid = __libc_pid;
|
||||||
|
|
||||||
info.si_uid = __libc_uid;
|
info.si_uid = getuid ();
|
||||||
|
|
||||||
info.si_value = val;
|
info.si_value = val;
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ char **__libc_argv;
|
|||||||
|
|
||||||
/* We often need the UID and PID. Cache these values. */
|
/* We often need the UID and PID. Cache these values. */
|
||||||
pid_t __libc_pid = 0xf00baa;
|
pid_t __libc_pid = 0xf00baa;
|
||||||
uid_t __libc_uid = 0xf00baa;
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -23,7 +23,6 @@ extern int __syscall_rt_sigqueueinfo (int, int, siginfo_t *);
|
|||||||
|
|
||||||
/* These variables are used quite often in the libc code. */
|
/* These variables are used quite often in the libc code. */
|
||||||
extern pid_t __libc_pid;
|
extern pid_t __libc_pid;
|
||||||
extern uid_t __libc_uid;
|
|
||||||
|
|
||||||
|
|
||||||
/* Return any pending signal or wait for one for the given time. */
|
/* Return any pending signal or wait for one for the given time. */
|
||||||
@ -40,14 +39,11 @@ __sigqueue (pid, sig, val)
|
|||||||
info.si_errno = 0;
|
info.si_errno = 0;
|
||||||
info.si_code = SI_QUEUE;
|
info.si_code = SI_QUEUE;
|
||||||
|
|
||||||
if (__libc_pid ==0xf00baa)
|
if (__libc_pid == 0xf00baa)
|
||||||
__libc_pid = __getpid ();
|
__libc_pid = __getpid ();
|
||||||
info.si_pid = __libc_pid;
|
info.si_pid = __libc_pid;
|
||||||
|
|
||||||
if (__libc_uid ==0xf00baa)
|
info.si_uid = __getuid ();
|
||||||
__libc_pid = __getuid ();
|
|
||||||
info.si_uid = __libc_uid;
|
|
||||||
|
|
||||||
info.si_value = val;
|
info.si_value = val;
|
||||||
|
|
||||||
return __syscall_rt_sigqueueinfo (pid, sig, &info);
|
return __syscall_rt_sigqueueinfo (pid, sig, &info);
|
||||||
|
Reference in New Issue
Block a user