aboutsummaryrefslogtreecommitdiff
path: root/nis
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-10-12 04:05:44 +0000
committerUlrich Drepper <drepper@redhat.com>1997-10-12 04:05:44 +0000
commitdfd2257ad98eb0f6eab167e5fe5ff68ca87172e3 (patch)
tree598abc70247c1d029e6ac2ddb8cf127b81e442e4 /nis
parenta5a0310d8e9d7176bb17e91c916272006a871016 (diff)
downloadglibc-dfd2257ad98eb0f6eab167e5fe5ff68ca87172e3.tar
glibc-dfd2257ad98eb0f6eab167e5fe5ff68ca87172e3.tar.gz
glibc-dfd2257ad98eb0f6eab167e5fe5ff68ca87172e3.tar.bz2
glibc-dfd2257ad98eb0f6eab167e5fe5ff68ca87172e3.zip
1997-10-12 05:09 Ulrich Drepper <drepper@cygnus.com> * libio/Makefile (routines): Remove iofprintf. * stdio-common/fprintf.c [USE_IN_LIBIO]: Define _IO_fprintf. * libio/filedoalloc.c: Use _G_stat64 instead of stat. * libio/fileops.c (_IO_file_open): Change to take extra argument indicating whether 32 or 64 bit mode is wanted. * libio/iofopen.c: Call _IO_file_open with extra argument set to 0. * libio/iofopen64.c: Call _IO_file_open with extra argument set to 0. * libio/iolibio.h (_IO_freopen, _IO_freopen64): Likewise. * libio/iofgetpos.c: Pretty print. * libio/iofgetpos64.c: Use _IO_fpos64_t for local variable `pos'. * manual/conf.texi: Document all the _SC_ and _CS_ constants. * manual/creature.texi: Document _LARGEFILE_SOURCE, _LARGEFILE64_SOURCE and _FILE_OFFSET_BITS. * manual/llio.texi: Document truncate and ftruncate. * manual/stdio.texi: Document positional parameters for printf. * math/Makefile (headers): Add tgmath.h. (libm-support): Remove s_lrint, s_llrint, s_lround, and s_llround and move to ... (libm-calls): ... here. Add scalbln, s_nextafterx and s_fma. * math/libm-test.c (lround_test, llround_test): Test for all FP formats by using FUNC(). * math/libm.map: Add fma, fmaf, fmal, nextafterx, nextafterxf, nextafterxl, scalbln, scalblnf, scalblnl, lrintf, lrintl, llrintf, llrintl, lroundf, lroundl, llroundf, and llroundl. * math/math.h: Document new platform specific macros from mathdef.h. Remove declaration of lrint, llrint, lround, and llround. * math/test-double.c: Define TEST_DOUBLE. * math/test-idouble.c: Likewise. * math/test-float.c: Define TEST_FLOAT. * math/test-ifloat.c: Likewise. * math/tgmath.h: New file. * math/bits/mathcalls.h: Add nextafterx, scalbln, fma, lrint, llrint, lround, and llround. Change second argument of scalbn to `int'. * sysdeps/libm-ieee754/s_fma.S: New file. * sysdeps/libm-ieee754/s_fmaf.S: New file. * sysdeps/libm-ieee754/s_fmal.S: New file. * sysdeps/libm-i387/s_fma.S: New file. * sysdeps/libm-i387/s_fmaf.S: New file. * sysdeps/libm-i387/s_fmal.S: New file. * sysdeps/libm-i387/s_llrint.S: Change to take double argument. * sysdeps/libm-i387/s_lrint.S: Likewise. * sysdeps/libm-i387/s_llrintf.S: New file. * sysdeps/libm-i387/s_llrintl.S: New file. * sysdeps/libm-i387/s_lrintf.S: New file. * sysdeps/libm-i387/s_lrintl.S: New file. * sysdeps/libm-ieee754/s_llrint.c: Remove version which works on 80bit double. * sysdeps/libm-ieee754/s_lrint.c: Likewise. * sysdeps/libm-ieee754/s_llrintf.S: New file. * sysdeps/libm-ieee754/s_llrintl.S: New file. * sysdeps/libm-ieee754/s_lrintf.S: New file. * sysdeps/libm-ieee754/s_lrintl.S: New file. * sysdeps/libm-i387/s_scalbln.c: New file. Empty file. * sysdeps/libm-i387/s_scalblnf.c: New file. Empty file. * sysdeps/libm-i387/s_scalblnl.c: New file. Empty file. * sysdeps/libm-i387/s_scalbn.c: Add scalbln as alias. * sysdeps/libm-i387/s_scalbnf.c: Add scalblnf as alias. * sysdeps/libm-i387/s_scalbnl.c: Add scalblnl as alias. * sysdeps/libm-ieee754/s_llround.c: Remove version which works on 80bit double. * sysdeps/libm-ieee754/s_lround.c: Likewise. * sysdeps/libm-ieee754/s_llroundf.c: Likewise. * sysdeps/libm-ieee754/s_llroundl.c: Likewise. * sysdeps/libm-ieee754/s_lroundf.c: Likewise. * sysdeps/libm-ieee754/s_lroundl.c: Likewise. * sysdeps/libm-ieee754/s_nextafterl.c: Add alias fo nextafterxl. * sysdeps/libm-ieee754/s_nextafterx.c: New file. * sysdeps/libm-ieee754/s_nextafterxf.c: New file. * sysdeps/libm-ieee754/s_nextafterxl.c: New file. * sysdeps/libm-ieee754/s_scalbln.c: New file. * sysdeps/libm-ieee754/s_scalblnf.c: New file. * sysdeps/libm-ieee754/s_scalblnl.c: New file. * sysdeps/libm-ieee754/s_scalbn.c: Change to take `int' as second arg. * sysdeps/libm-ieee754/s_scalbnf.c: Likewise. * sysdeps/libm-ieee754/s_scalbnl.c: Likewise. * stdlib/stdlib.h: Protect declarations of __strto*l_internal functions by #ifdefs since they are duplicated in inttypes.h. * sysdeps/wordsize-32/inttypes.h: Add definition of strtoimax and strtoumax plus needed declarations. * sysdeps/generic/confname.h (_SC_AIO_LISTIO_MAX): Fix typo. 1997-10-09 Andreas Jaeger <aj@arthur.rhein-neckar.de> * locale/programs/locfile.c (locfile_read): Correct while loop. * db2/makedb.c (main): Add missing parameter for error output. (process_input): Likewise. * resolv/gethnamaddr.c (getanswer): Rewrite a bit to avoid warning. 1997-10-12 05:05 Ulrich Drepper <drepper@cygnus.com> * libc-map: Add __bzero, __mempcpy. 1997-10-10 18:51 David S. Miller <davem@tanya.rutgers.edu> * sysdeps/unix/sysv/linux/sparc/bits/ioctls.h: Remove dependencies on kernel_termios.h 1997-10-09 10:24 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> Add the changes from the Solaris 2.6 header files, use the new public defines/functions. * nis/nis_addmember.c: Updated. * nis/nis_checkpoint.c: Updated. * nis/nis_creategroup.c: updated. * nis/nis_destroygroup.c: Updated. * nis/nis_getservlist.c: Updated. * nis/nis_ismember.c: Updated. * nis/nis_lookup.c: Updated. * nis/nis_modify.c: Updated. * nis/nis_ping.c: Updated. * nis/nis_print.c: Updated. * nis/nis_print_group_entry.c: Updated. * nis/nis_remove.c: Updated. * nis/nis_removemember.c: Updated. * nis/nis_xdr.c: Updated. * nis/nss_nisplus/nisplus-alias.c: Updated. * nis/nss_nisplus/nisplus-ethers.c: Updated. * nis/nss_nisplus/nisplus-hosts.c: Updated. * nis/nss_nisplus/nisplus-network.c: Updated. * nis/nss_nisplus/nisplus-parser.c: Updated. * nis/nss_nisplus/nisplus-proto.c: Updated. * nis/nss_nisplus/nisplus-rpc.c: Updated. * nis/nss_nisplus/nisplus-service.c: Updated. * nis/rpcsvc/nis.h: Updated. * nis/rpcsvc/nis.x: Updated. * nis/rpcsvc/nis_object.x: Updated. * nis/rpcsvc/nis_tags.h: Updated. * nis/rpcsvc/nislib.h: Updated. * nis/lckcache.c: Removed, since Sun has dropped the directory signatures. The old cache version is now a security risk and not longer supported by Sun. * nis/nis_cache.c: Likewise. * nis/rpcsvc/nis_cache.h: Likewise. * nis/rpcsvc/nis_cache.x: Likewise. * nis/nis_call.c: Remove calls to the cache functions. * nis/libnsl.map: Remove cache and depending functions. * nis/nis_intern.h: Likewise. * nis/nis_add.c: Remove #include <rpcsvc/nislib.h>. * nis/nis_domain_of.c: Likewise. * nis/nis_domain_of_r.c: Likewise. * nis/nis_error.c: Likewise. * nis/nis_file.c: Likewise. * nis/nis_local_names.c: Likewise. * nis/nis_mkdir.c: Likewise. * nis/nis_rmdir.c: Likewise. * nis/nis_subr.c: Likewise. * nis/nis_verifygroup.c: Likewise. * nis/nis_clone.c: Removed, replaced by ... * nis/nis_clone_dir.c: New. * nis/nis_clone_obj.c: New. * nis/nis_clone_res.c: New. * nis/nis_table.c: Fixed bugs shown through the new clone functions. * nis/nis_defaults.c: Fixed a lot of race conditions. * nis/nis_free.c: Rewritten. * sunrpc/auth_des.c: Fix use of free'ed pointer. * nis/Makefile (libnsl-routines): Remove nis_clone, nis_cache and lckcache. Add nis_clone_dir, nis_clone_obj, and nis_clone_res. 1997-10-09 Andreas Jaeger <aj@arthur.rhein-neckar.de> * wctype/test_wctype.c (TEST): Add parens to avoid ambiguity. 1997-10-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * include/features.h: Don't crash if _XOPEN_SOURCE is defined to be empty. 1997-10-09 05:54 Ulrich Drepper <drepper@cygnus.com> * nss/digits_dots.c: Place `result' in resbuf and not in `buffer'. * nss/getXXbyYY_r.c: Make sure digits_dots.c sees `resbuf' as struct and not a pointer. Little optimizations. 1997-10-09 05:00 Ulrich Drepper <drepper@cygnus.com> * sysdeps/stub/getenv.c: Remove unused file. * sysdeps/stub/lxstat.c: Likewise. * sysdeps/stub/morecore.c: Likewise. * sysdeps/stub/putenv.c: Likewise. * sysdeps/stub/sbrk.c: Likewise. * sysdeps/stub/setenv.c: Likewise. * sysdeps/stub/sysd-stdio.c: Likewise. * sysdeps/stub/sysdep.h: Likewise. Reported by Zack Weinberg <zack@rabi.phys.columbia.edu>. 1997-10-09 04:58 Ulrich Drepper <drepper@cygnus.com> * configure.in: Add __bzero definition to DWARF2 unwind test. Reported by David S. Miller <davem@caip.rutgers.edu>. 1997-10-07 Paul Eggert <eggert@twinsun.com> * intl/loadmsgcat.c (_nl_load_domain): Fix &&/|| typo when checking file size. Check for overflow when stuffing off_t into size_t. 1997-10-07 18:11 Ulrich Drepper <drepper@cygnus.com> * time/africa: Update from tzdata1997i. 1997-10-07 Andreas Jaeger <aj@arthur.rhein-neckar.de> * posix/globtest.sh: Add arguments for name of dynamic linker and call dynamic linker to execute globtest. * posix/Makefile (tests): Supply arguments to globtest.sh. 1997-10-07 Andreas Jaeger <aj@arthur.rhein-neckar.de> * nis/rpcsvc/ypupd.h: Add missing __END_DECLS. 1997-10-03 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * libc.map: Add mempcpy, prctl. 1997-09-30 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/generic/memcmp.c: Avoid warnings. * sysdeps/generic/memset.c: Likewise. * sysdeps/generic/strchr.c: Likewise. * sysdeps/generic/strlen.c: Likewise. 1997-09-29 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * malloc/Makefile ($(objpfx)mtrace): Fix typo. 1997-09-29 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/dl-machine.h (elf_machine_rela): Fix last change. The R_68K_GLOB_DAT and R_68K_JMP_SLOT relocations really ignore the addend, Richard. (elf_machine_fixup_plt): Don't add the addend. (elf_machine_plt_value): New function. * sysdeps/alpha/dl-machine.h (elf_machine_plt_value): New function. * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_plt_value): New function. * sysdeps/sparc/sparc64/dl-machine.h (elf_machine_plt_value): New function. * sysdeps/powerpc/dl-machine.h (elf_machine_plt_value): New function. * sysdeps/i386/dl-machine.h (elf_machine_plt_value): New function. * elf/dl-runtime.c (fixup, profile_fixup): Don't add in the addend, instead let the machine dependent setup decide. 1997-09-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/m68020/bits/string.h: New file. 1997-10-07 04:27 Richard Henderson <rth@cygnus.com> * Makeconfig (+includes): Add -I$(objpfx). * stdlib/longlong.h [__sparc__]: Prototype __udiv_qrnnd. * sysdeps/alpha/setjmp.S: __setjmp is the same as _setjmp. Make the former a strong symbol and the later a weak alias. * sysdeps/sparc/sparc32/setjmp.S: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/setjmp.S: Likewise. 1997-10-06 21:01 David S. Miller <davem@tanya.rutgers.edu> * sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Make ino_t 64-bits. * sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h: Make st_ino member 64-bits as well, to match the kernel. 1997-10-06 19:35 Ulrich Drepper <drepper@cygnus.com> * sysdeps/sparc/sparc64/sub_n.S: Fix typo. Patch by Jakub Jelinek <jj@sunsite.ms.mff.cuni.cz>. 1997-10-06 01:09 Zack Weinberg <zack@rabi.phys.columbia.edu> * time/README: Correct list of files from tzcode package. Add contact information for tzcode/tzdata maintainers. Correct spelling of author's name. Compact lists. 1997-10-06 01:48 Ulrich Drepper <drepper@cygnus.com> * malloc/malloc.h: Remove hook definition without caller argument. * malloc/malloc.c: Likewise. * string/tester.c: Correct strsep test. * string/bits/string2.h: Define __string2_1bptr_p and use it. Patch by David S. Miller <davem@tanya.rutgers.edu>. * math/Makefile (routines): Add s_clog10. * math/libm-test.c: Add test for clog10. * math/libm.map: Add clog10{,f,l}. * math/bits/cmathcalls.h [__USE_GNU]: Add clog10. * sysdeps/libm-ieee754/s_clog10.c: New file. * sysdeps/libm-ieee754/s_clog10f.c: New file. * sysdeps/libm-ieee754/s_clog10l.c: New file. * manual/math.texi: Describe clog10. * config.h.in: Add USE_REGPARMS and define internal_function based on this. * configure.in: Define USE_REGPARMS for ix86 machines. * gmon/gmon.c: Mark write_hist, write_call_graph and write_bb_counts as internal functions. * inet/getnameinfo.c: Likewise for nrl_domainname. * inet/getnetgrent_r.c: Likewise for __internal_setnetgrent_reuse. * inet/rcmd.c: Likewise for __icheckhost. * intl/dcgettext.c: Likewise for category_to_name and guess_category_value. * intl/localealias.c: Likewise for read_alias_file. * io/fts.c: Likewise for fts_alloc, fts_build, fts_lfree, fts_maxarglen, fts_padjust, fts_palloc, fts_sort, and fts_stat. * libio/genops.c: Likewise for save_for_backup. * malloc/malloc.c (chunk_free, chunk_alloc, chunk_realloc, chunk_align, main_trim, heap_trim): Likewise. * malloc/mtrace.c (tr_where): Likewise. * misc/fstab.c (mnt2fs): Likewise. * misc/getttyent.c (skip, value): Likewise. * misc/syslog.c (openlog_internal): Likewise. * misc/tsearch.c (trecurse, tdestroy_internal): Likewise. * nss/nsswitch.c (nss_lookup_function, nss_parse_file, nss_getline, nss_parse_service_list, nss_new_service): Likewise. * posix/wordexp.c (parse_dollars, parse_backtick, eval_expr): Likewise. * resolv/inet_ntop.c (inet_ntop4, inet_ntop6): Likewise. * resolv/inet_pton.c (inet_pton4, inet_pton6): Likewise. * resolv/res_init.c (res_setoptions): Likewise. * stdio-common/printf_fp.c (group_number): Likewise. * stdio-common/vfprintf.c (buffered_vfprintf, group_number): Likewise. * stdlib/fmtmsg.c (internal_addseverity): Likewise. * sunrpc/auth_des.c (synchronize): Likewise. * sunrpc/auth_unix.c (marshal_new_auth): Likewise. * sunrpc/clnt_perr.c (auth_errmsg): Likewise. * sunrpc/key_call.c (key_call): Likewise. * sunprc/pmap_rmt.c (getbroadcastnets): Likewise. * sunrpc/svc_tcp.c (makefd_xprt): Likewise. * sunrpc/svcauth_des.c (cache_init, cache_spot, cache_ref, invalidate): Likewise. * sunrpc/xdr_rec.c (fix_buf_size, skip_input_bytes, flush_out, set_input_fragment, get_input_bytes): Likewise. * sysdeps/unix/sysv/linux/getsysstats.c (get_proc_path, phys_pages_info): Likewise. * sysdeps/unix/sysv/linux/if_index.c (opensock): Likewise. * sysdeps/unix/sysv/linux/poll.c (__emulate_poll): Likewise. * sysdeps/unix/sysv/linux/readv.c (__atomic_readv_replacement): Likewise. * sysdeps/unix/sysv/linux/readv.c (__atomic_writev_replacement): Likewise. * time/strptime.c (strptime_internal): Likewise. * time/tzfile.c (find_transition, compute_tzname_max): Likewise. * time/tzset.c (compute_change, tz_compute, tzset_internal): Likewise. * libc.map: Remove _libio_using_thunks, add _fp_hw and _dl_addr. * ctype/ctype.h: Pretty print. * grp/grp.h: Likewise. * include/libc-symbols.h: Likewise. * include/limits.h: Likewise. * include/values.h: Likewise. * io/fcntl.h: Likewise. * io/sys/stat.h: Likewise. * libio/stdio.h: Likewise. * malloc/malloc.h: Likewise. * misc/err.h: Likewise. * misc/regexp.h: Likewise. * misc/sys/cdefs.h: Likewise. * misc/sys/file.h: Likewise. * posix/sys/utsname.h: Likewise. * posix/sys/wait.h: Likewise. * pwd/pwd.h: Likewise. * resolv/netdb.h: Likewise. * signal/signal.h: Likewise. * stdlib/stdlib.h: Likewise. * string/endian.h: Likewise. * string/memory.h: Likewise. * sysdeps/mach/hurd/bits/fcntl.h: Likewise. * sysdeps/mach/hurd/sys/param.h: Likewise. * sysdeps/unix/sysv/linux/sys/param.h: Likewise. * termios/termios.h: Likewise. * wcsmbs/wchar.h: Likewise. * wctype/wctype.h: Likewise. * sysdeps/unix/bsd/bsd4.4/wait3.c: Use __WAIT_STATUS in definition. Implement Large File Support API. * include/features.h: Add suuport for _LARGEFILE_SOURCE, _LARGEFILE64_SOURCE, and _FILE_OFFSET_BITS. * libc.map: Add new functions for LFS. * dirent/Makefile (routines): Add readdir64 and readdir64_r. * dirent/dirent.h: Update readdir prototype for LFS and add new prototypes for above functions. * io/Makefile (routines): Add xstat64, fxstat64, lxstat64, statfs64, fstatfs64, lstat64, open64, lseek64, creat64, and ftw64. * io/creat64.c: New file. * io/fstat64.c: New file. * io/lstat64.c: New file. * io/stat64.c: New file. * io/ftw64.c: New file. * io/ftw.c: Rewrite to allow easy definition of ftw64. * io/ftw.h: Add LFS interface. * io/fcntl.h: Likewise. * io/sys/stat.h: Likewise. * io/sys/statfs.h: Likewise. * libio/Makefile (routines): Add iofgetpos64, iofopen64, iofsetpos64, freopen64, fseeko64, and ftello64. * libcio/fseeko64.c: New file. * libio/ftello64.c: New file. * libio/iofgetpos64.c: New file. * libio/iofopen64.c: New file. * libio/iofsetpos64.c: New file. * libio/fileops.c (_IO_file_fopen): Change to use _IO_off64_t. (_IO_file_attach): Likewise. (_IO_do_write): Likewise. (_IO_file_sync): Likewise. (_IO_file_seek): Likewise. (_IO_file_seekoff): Likewise. Use _G_stat64. (_IO_file_fopen64): New function. (_IO_file_jumps): Initialize showmanyc and imbue. * libio/genops.c (_IO_default_seekpos): Change to use _IO_fpos64_t. (_IO_default_seekoff): Likewise. (_IO_default_seek): Likewise. (_IO_default_showmanyc, _IO_default_imbue): New functions. * libio/iofopncook.c (_IO_cookie_seek): Change to use _IO_off64_t. * libio/iolibio.h: Add prototypes for LFS functions. * libio/ioseekoff.c: Change to use _IO_fpos64_t. * libio/ioseekpos.c: Likewise. * libio/libio.h: Define _IO_fpos64_t and _IO_off64_t. (_IO_FILE): Move _offset field to end and change type to _IO_off64_t. (_IO_seekoff, _IO_seekpos): Change prototype. * libio/libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t): Change to use _IO_off64_t. Change prototypes for function from the *ops.c files. * libio/stdio.h: Add LFS interface definition. * libio/strops.c (_IO_str_seekoff): Change to use _IO_fpos64_t. * posix/Makefile (routines): Add pread64 and pwrite64. * posix/confstr.c: Handle _CS_LFS* requests. * posix/getconf.c: Handle LFS* requests. * sysdeps/generic/confname.h: Add _CS_LFS* constants. * posix/unistd.h: Document _LFS64_LARGEFILE and _LFS64_STDIO. Define off_t and off64_t appropriately. Change prototypes of LFS functions. * posix/sys/types.h: Add LFS types. * resources/Makefile (routines): Add getrlimit64 and setlimit64. * resource/sys/resource.h: Change prototypes of LFS functions. * stdio-common/Makefile (routines): Add tmpfile64. * stdio-common/tmpfile64.c: New file. * sysdeps/generic/_G_config.h: Define _G_fpos64_t and _G_off64_t. Define _G_OPEN64, _G_LSEEK64, _G_FSTAT64. * sysdeps/unix/sysv/linux/_G_config.h: Likewise. * sysdeps/generic/bits/resource.h: Add LFS definitions. * sysdeps/unix/bsd/sun/sunos4/bits/resource.h: Likewise. * sysdeps/unix/sysv/linux/bits/resource.h: Likewise. * sysdeps/generic/statfs.h: Use __fsblkcnt_t for some of the fields. * sysdeps/unix/sysv/linux/bits/statfs.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/statfs.h: Likewise. * sysdeps/generic/types.h: Define LFS types. * sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise. * sysdeps/generic/sys/mman.h: Add LFS definitions. * sysdeps/unix/sysv/linux/sys/mman.h: Likewise. * sysdeps/generic/mach/hurd/bits/fcntl.h: Add flock LFS extensions. * sysdeps/unix/bsd/bits/fcntl.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Likewise. * sysdeps/unix/sysv/linux/bits/fcntl.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Likewise. * sysdeps/generic/mach/hurd/bits/stat.h: Add stat LFS extensions. * sysdeps/unix/bsd/bits/stat.h: Likewise. * sysdeps/unix/bsd/osf/alpha/bits/stat.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/stat.h: Likewise. * sysdeps/unix/sysv/linux/bits/stat.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/stat.h: Likewise. * sysdeps/unix/sysv/sysv4/i386/bits/stat.h: Likewise. * sysdeps/unix/sysv/sysv4/solaris2/bits/stat.h: Likewise. * sysdeps/posix/open64.c: New file. * sysdeps/stub/fstatfs64.c: New file. * sysdeps/stub/fxstat64.c: New file. * sysdeps/stub/getrlimit64.c: New file. * sysdeps/stub/lseek64.c: New file. * sysdeps/stub/lxstat64.c: New file. * sysdeps/stub/open64.c: New file. * sysdeps/stub/pread64.c: New file. * sysdeps/stub/pwrite64.c: New file. * sysdeps/stub/readdir64.c: New file. * sysdeps/stub/readdir64_r.c: New file. * sysdeps/stub/setrlimit64.c: New file. * sysdeps/stub/statfs64.c: New file. * sysdeps/stub/xstat64.c: New file. * sysdeps/unix/sysv/linux/llseek.c: Define as __llseek and make llseek and lseek64 weak aliases. * sysdeps/unix/sysv/linux/lseek64.c: New file. Empty. * sysdeps/unix/sysv/linux/alpha/bits/dirent.h: New file. * sysdeps/unix/sysv/linux/bits/dirent.h: Add LFS definitions. * sysdeps/posix/tempname.c: Add extra argument to trigger use of open64. * sysdeps/stub/tempname.c: Likewise. * stdio-common/tempnam.c: Call __stdio_gen_tempname with extra argument. * stdio-common/tmpfile.c: Likewise. * stdio-common/tmpnam.c: Likewise. * stdio-common/tmpnam_r.c: Likewise. * libio/libioP.h: Add definition ofr showmanyc and imbue callbacks. * libio/fileops.c (_IO_file_jumps): Initialize showmanyc and imbue. * libio/iofopncook.c (_IO_cookie_jumps): Likewise. * libio/iopopen.c (_IO_proc_jumps): Likewise. * libio/memstream.c (_IO_mem_jumps): Likewise. * libio/obprintf.c (_IO_obstack_jumps): Likewise. * libio/vsnprintf.c (_IO_strn_jumps): Likewise. * libio/strops.c (_IO_str_jumps): Likewise. * manual/arith.texi: Add a few words why cabs should be used. * manual/llio.texi: Describe sync, fsync, fdatasync. Tell about cleanup handlers & fcntl,lseek,write,read,close,open. * manual/process.texi: Tell about cleanup handlers & system,waitpid, wait. * manual/signal.texi: Likewise for pause. * manual/terminal.texi: Likewise for tcdrain. * manual/time.texi: Document nanosleep. * posix/exevp.c: Don't use nested function. * stdlib/ucontext.h: New file. * sysdeps/i386/sys/ucontext.h: New file. SysV/i386 API definitions. * sunrpc/xcrypt.c (hexval): Make a macro for efficiency. * sysdeps/i386/setjmp.h: Make `here` label local. * sysdeps/i386/elf/start.S: Define _fp_hw "variable". * sysdeps/stub/fstatfs.c: Correct warning. * sysdeps/stub/fxstat.c: Likewise. * sysdeps/stub/lxstat.c: Likewise. * sysdeps/unix/sysv/i386/i686/time.S: New file. 1997-10-03 20:56 Jason Merrill <jason@yorick.cygnus.com> * malloc/obstack.h (obstack_empty_p): New macro. 1997-10-04 17:41 Philip Blundell <Philip.Blundell@pobox.com> * inet/getnameinfo.c (getnameinfo): Remove spurious `#if INET6'. 1997-09-30 Zack Weinberg <zack@rabi.phys.columbia.edu> * maint.texi: Add copyright terms for libdb (Sleepycat, Harvard). Document new --with-binutils switch; delete reference to --with-gnu-as, --with-gnu-ld, --with-gnu-binutils. Add to description of --without-fp: a kernel FPU emulator is adequate (from FAQ) * INSTALL: Regenerated. 1997-09-30 17:29 Richard Henderson <rth@cygnus.com> * sysdeps/sparc/sparc32/dl-machine.h (elf_machine_rela): Move _dl_hwcap declaration to ... (elf_machine_fixup_plt): ... here.
Diffstat (limited to 'nis')
-rw-r--r--nis/Banner2
-rw-r--r--nis/Makefile9
-rw-r--r--nis/TODO3
-rw-r--r--nis/lckcache.c181
-rw-r--r--nis/libnsl.map31
-rw-r--r--nis/nis_add.c1
-rw-r--r--nis/nis_addmember.c27
-rw-r--r--nis/nis_cache.c307
-rw-r--r--nis/nis_call.c9
-rw-r--r--nis/nis_checkpoint.c22
-rw-r--r--nis/nis_clone.c573
-rw-r--r--nis/nis_clone_dir.c69
-rw-r--r--nis/nis_clone_obj.c69
-rw-r--r--nis/nis_clone_res.c69
-rw-r--r--nis/nis_creategroup.c3
-rw-r--r--nis/nis_defaults.c66
-rw-r--r--nis/nis_destroygroup.c3
-rw-r--r--nis/nis_domain_of.c1
-rw-r--r--nis/nis_domain_of_r.c1
-rw-r--r--nis/nis_error.c1
-rw-r--r--nis/nis_file.c2
-rw-r--r--nis/nis_free.c300
-rw-r--r--nis/nis_getservlist.c15
-rw-r--r--nis/nis_intern.h4
-rw-r--r--nis/nis_ismember.c155
-rw-r--r--nis/nis_local_names.c1
-rw-r--r--nis/nis_lookup.c5
-rw-r--r--nis/nis_mkdir.c1
-rw-r--r--nis/nis_modify.c3
-rw-r--r--nis/nis_ping.c5
-rw-r--r--nis/nis_print.c105
-rw-r--r--nis/nis_print_group_entry.c134
-rw-r--r--nis/nis_remove.c3
-rw-r--r--nis/nis_removemember.c33
-rw-r--r--nis/nis_rmdir.c1
-rw-r--r--nis/nis_subr.c1
-rw-r--r--nis/nis_table.c178
-rw-r--r--nis/nis_verifygroup.c1
-rw-r--r--nis/nis_xdr.c16
-rw-r--r--nis/nss_nisplus/nisplus-alias.c2
-rw-r--r--nis/nss_nisplus/nisplus-ethers.c2
-rw-r--r--nis/nss_nisplus/nisplus-hosts.c4
-rw-r--r--nis/nss_nisplus/nisplus-network.c4
-rw-r--r--nis/nss_nisplus/nisplus-parser.c6
-rw-r--r--nis/nss_nisplus/nisplus-proto.c4
-rw-r--r--nis/nss_nisplus/nisplus-rpc.c4
-rw-r--r--nis/nss_nisplus/nisplus-service.c4
-rw-r--r--nis/rpcsvc/nis.h52
-rw-r--r--nis/rpcsvc/nis.x118
-rw-r--r--nis/rpcsvc/nis_cache.h47
-rw-r--r--nis/rpcsvc/nis_cache.x47
-rw-r--r--nis/rpcsvc/nis_object.x34
-rw-r--r--nis/rpcsvc/nis_tags.h7
-rw-r--r--nis/rpcsvc/nislib.h20
-rw-r--r--nis/rpcsvc/ypupd.h2
55 files changed, 857 insertions, 1910 deletions
diff --git a/nis/Banner b/nis/Banner
index d6cf7a9f5e..c280caad63 100644
--- a/nis/Banner
+++ b/nis/Banner
@@ -1 +1 @@
-NIS(YP)/NIS+ NSS modules 0.14 by Thorsten Kukuk
+NIS(YP)/NIS+ NSS modules 0.15 by Thorsten Kukuk
diff --git a/nis/Makefile b/nis/Makefile
index 82c5f24963..e114faf1c7 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -44,14 +44,15 @@ vpath %.c $(subdir-dirs)
libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
nis_subr nis_local_names nis_free nis_file \
- nis_print nis_error nis_call nis_lookup nis_clone\
- nis_cache nis_table nis_xdr nis_server nis_ping\
+ nis_print nis_error nis_call nis_lookup\
+ nis_table nis_xdr nis_server nis_ping\
nis_checkpoint nis_mkdir nis_rmdir nis_getservlist\
nis_verifygroup nis_ismember nis_addmember nis_util\
nis_removemember nis_creategroup nis_destroygroup\
nis_print_group_entry nis_domain_of nis_domain_of_r\
- nis_modify nis_remove nis_add nis_defaults lckcache\
- nis_findserv nis_callback
+ nis_modify nis_remove nis_add nis_defaults\
+ nis_findserv nis_callback nis_clone_dir nis_clone_obj\
+ nis_clone_res
libnsl-map = libnsl.map
libnss_compat-routines := $(addprefix compat-,grp pwd spwd) nisplus-parser
diff --git a/nis/TODO b/nis/TODO
deleted file mode 100644
index 8528de7e1a..0000000000
--- a/nis/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-
- * nis_addmember: Where checks for duplicate group members ? nisgrpadm or
- nis_addmember ?
diff --git a/nis/lckcache.c b/nis/lckcache.c
deleted file mode 100644
index f8c0a97296..0000000000
--- a/nis/lckcache.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* Handle locking of NIS+ cache file.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library and based on shadow/lckfile.c.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <fcntl.h>
-#include <bits/libc-lock.h>
-#include <shadow.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/file.h>
-#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
-#include <rpcsvc/nis_cache.h>
-
-/* How long to wait for getting the lock before returning with an
- error. */
-#define TIMEOUT 5 /* sec */
-
-
-/* File descriptor for lock file. */
-static int lock_fd = -1;
-
-/* Prevent problems in multithreaded program by using mutex. */
-__libc_lock_define_initialized (static, lock)
-
-
-/* Prototypes for local functions. */
-static void noop_handler __P ((int __sig));
-
-
-/* We cannot simply return in error cases. We have to close the file
- and perhaps restore the signal handler. */
-#define RETURN_CLOSE_FD(code) \
- do { \
- if ((code) < 0 && lock_fd >= 0) \
- { \
- close (lock_fd); \
- lock_fd = -1; \
- } \
- __libc_lock_unlock (lock); \
- return (code); \
- } while (0)
-
-#define RETURN_RESTORE_HANDLER(code) \
- do { \
- /* Restore old action handler for alarm. We don't need to know \
- about the current one. */ \
- sigaction (SIGALRM, &saved_act, NULL); \
- RETURN_CLOSE_FD (code); \
- } while (0)
-
-#define RETURN_CLEAR_ALARM(code) \
- do { \
- /* Clear alarm. */ \
- alarm (0); \
- /* Restore old set of handled signals. We don't need to know \
- about the current one.*/ \
- sigprocmask (SIG_SETMASK, &saved_set, NULL); \
- RETURN_RESTORE_HANDLER (code); \
- } while (0)
-
-
-int
-__nis_lock_cache (void)
-{
- int flags;
- sigset_t saved_set; /* Saved set of caught signals. */
- struct sigaction saved_act; /* Saved signal action. */
- sigset_t new_set; /* New set of caught signals. */
- struct sigaction new_act; /* New signal action. */
- struct flock fl; /* Information struct for locking. */
- int result;
-
- if (lock_fd != -1)
- /* Still locked by own process. */
- return -1;
-
- /* Prevent problems caused by multiple threads. */
- __libc_lock_lock (lock);
-
- lock_fd = open (CACHELOCK, O_RDONLY|O_CREAT, 0666);
- if (lock_fd == -1)
- /* Cannot create lock file. */
- RETURN_CLOSE_FD (-1);
-
- /* Make sure file gets correctly closed when process finished. */
- flags = fcntl (lock_fd, F_GETFD, 0);
- if (flags == -1)
- /* Cannot get file flags. */
- RETURN_CLOSE_FD (-1);
- flags |= FD_CLOEXEC; /* Close on exit. */
- if (fcntl (lock_fd, F_SETFD, flags) < 0)
- /* Cannot set new flags. */
- RETURN_CLOSE_FD (-1);
-
- /* Now we have to get exclusive write access. Since multiple
- process could try this we won't stop when it first fails.
- Instead we set a timeout for the system call. Once the timer
- expires it is likely that there are some problems which cannot be
- resolved by waiting.
-
- It is important that we don't change the signal state. We must
- restore the old signal behaviour. */
- memset (&new_act, '\0', sizeof (struct sigaction));
- new_act.sa_handler = noop_handler;
- sigfillset (&new_act.sa_mask);
- new_act.sa_flags = 0ul;
-
- /* Install new action handler for alarm and save old. */
- if (sigaction (SIGALRM, &new_act, &saved_act) < 0)
- /* Cannot install signal handler. */
- RETURN_CLOSE_FD (-1);
-
- /* Now make sure the alarm signal is not blocked. */
- sigemptyset (&new_set);
- sigaddset (&new_set, SIGALRM);
- if (sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0)
- RETURN_RESTORE_HANDLER (-1);
-
- /* Start timer. If we cannot get the lock in the specified time we
- get a signal. */
- alarm (TIMEOUT);
-
- /* Try to get the lock. */
- memset (&fl, '\0', sizeof (struct flock));
- fl.l_type = F_RDLCK;
- fl.l_whence = SEEK_SET;
- result = fcntl (lock_fd, F_SETLKW, &fl);
-
- RETURN_CLEAR_ALARM (result);
-}
-
-
-int
-__nis_unlock_cache ()
-{
- int result;
-
- if (lock_fd == -1)
- /* There is no lock set. */
- result = -1;
- else
- {
- /* Prevent problems caused by multiple threads. */
- __libc_lock_lock (lock);
-
- result = close (lock_fd);
-
- /* Mark descriptor as unused. */
- lock_fd = -1;
-
- /* Clear mutex. */
- __libc_lock_unlock (lock);
- }
-
- return result;
-}
-
-
-static void
-noop_handler (sig)
- int sig;
-{
- /* We simply return which makes the `fcntl' call return with an error. */
-}
diff --git a/nis/libnsl.map b/nis/libnsl.map
index cf22d27d2f..49b3754e6d 100644
--- a/nis/libnsl.map
+++ b/nis/libnsl.map
@@ -1,20 +1,12 @@
GLIBC_2.0 {
global:
- __nis_default_access; __nis_default_group; __nis_default_owner;
- __nis_default_ttl; __nis_finddirectory; __nis_lock_cache;
- __nis_unlock_cache; __nis_hash;
- nis_add;
- nis_add_entry; nis_addmember; nis_checkpoint;
- nis_clone_directory; nis_clone_entry; nis_clone_group;
- nis_clone_link; nis_clone_nis_attr; nis_clone_objdata;
- nis_clone_object; nis_clone_result; nis_clone_table;
- nis_creategroup; nis_destroy_object; nis_destroygroup;
- nis_dir_cmp; nis_domain_of; nis_domain_of_r;
- nis_first_entry; nis_free_attr; nis_free_directory;
- nis_free_endpoints; nis_free_entry; nis_free_group;
- nis_free_link; nis_free_object; nis_free_request;
- nis_free_servers; nis_free_table; nis_freenames;
+ nis_add; nis_add_entry; nis_addmember;
+ nis_checkpoint; nis_clone_directory; nis_clone_object;
+ nis_clone_result; nis_creategroup; nis_destroy_object;
+ nis_destroygroup; nis_dir_cmp; nis_domain_of;
+ nis_domain_of_r; nis_first_entry; nis_free_directory;
+ nis_free_object; nis_free_request; nis_freenames;
nis_freeresult; nis_freeservlist; nis_freetags;
nis_getnames; nis_getservlist; nis_ismember;
nis_leaf_of; nis_leaf_of_r; nis_lerror;
@@ -31,8 +23,15 @@ GLIBC_2.0 {
nis_sperror; nis_sperror_r; nis_stats;
nis_verifygroup; nis_write_obj;
- readColdStartFile; writeColdStartFile;
+ # This functions are needed by the NIS+ tools and rpc.nisd,
+ # they should never be used in a normal user program !
+ __nis_default_access; __nis_default_group; __nis_default_owner;
+ __nis_default_ttl; __nis_free_fdresult; __nis_finddirectory;
+ __nis_hash; readColdStartFile; writeColdStartFile;
+ # Many programs expect this, but every user program should
+ # have it's own version, since the interface is different on
+ # various platforms.
xdr_cp_result; xdr_directory_obj; xdr_domainname;
xdr_dump_args; xdr_endpoint; xdr_entry_col;
xdr_entry_obj; xdr_fd_args; xdr_fd_result;
@@ -54,7 +53,7 @@ GLIBC_2.0 {
xdr_ypresp_xfr; xdr_ypstat; xdr_ypupdate_args;
xdr_ypxfrstat; xdr_zotypes;
- __yp_check;
+ __yp_check;
yp_all; yp_bind; yp_first;
yp_get_default_domain; yp_maplist; yp_master;
yp_match; yp_next; yp_order;
diff --git a/nis/nis_add.c b/nis/nis_add.c
index 6693a25766..d30ccde2f6 100644
--- a/nis/nis_add.c
+++ b/nis/nis_add.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
diff --git a/nis/nis_addmember.c b/nis/nis_addmember.c
index 8fd7e12a58..6d55bd0d07 100644
--- a/nis/nis_addmember.c
+++ b/nis/nis_addmember.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_addmember (const_nis_name member, const_nis_name group)
@@ -42,28 +41,28 @@ nis_addmember (const_nis_name member, const_nis_name group)
stpcpy (cp, cp2);
}
res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
- if (res->status != NIS_SUCCESS)
+ if (NIS_RES_STATUS (res) != NIS_SUCCESS)
{
- status = res->status;
+ status = NIS_RES_STATUS (res);
nis_freeresult (res);
return status;
}
- if ((res->objects.objects_len != 1) ||
- (res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
+ if ((NIS_RES_NUMOBJ (res) != 1) ||
+ (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
return NIS_INVALIDOBJ;
- res->objects.objects_val[0].GR_data.gr_members.gr_members_val
- = realloc (res->objects.objects_val[0].GR_data.gr_members.gr_members_val,
- (res->objects.objects_val[0].GR_data.gr_members.gr_members_len + 1)
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val
+ = realloc (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val,
+ (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len + 1)
* sizeof (char *));
- res->objects.objects_val[0].GR_data.gr_members.gr_members_val[res->objects.objects_val[0].GR_data.gr_members.gr_members_len] = strdup (member);
- ++res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len] = strdup (member);
+ ++NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len;
- cp = stpcpy (buf, res->objects.objects_val->zo_name);
+ cp = stpcpy (buf, NIS_RES_OBJECT(res)->zo_name);
*cp++ = '.';
- strncpy (cp, res->objects.objects_val->zo_domain, NIS_MAXNAMELEN);
- res2 = nis_modify (buf, res->objects.objects_val);
- status = res2->status;
+ strncpy (cp, NIS_RES_OBJECT (res)->zo_domain, NIS_MAXNAMELEN);
+ res2 = nis_modify (buf, NIS_RES_OBJECT (res));
+ status = NIS_RES_STATUS (res2);
nis_freeresult (res);
nis_freeresult (res2);
diff --git a/nis/nis_cache.c b/nis/nis_cache.c
deleted file mode 100644
index e10b8c07fd..0000000000
--- a/nis/nis_cache.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <fcntl.h>
-#include <unistd.h>
-#include <syslog.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <rpcsvc/nis.h>
-#include <rpcsvc/nis_cache.h>
-#include <bits/libc-lock.h>
-
-#include "nis_intern.h"
-
-static struct timeval TIMEOUT = {10, 0};
-
-#define HEADER_MAGIC 0x07021971
-#define SPACER_MAGIC 0x07654321
-
-#define CACHE_VERSION 0x00000001
-
-struct cache_header
-{
- u_long magic; /* Magic number */
- u_long vers; /* Cache file format version */
- u_short tcp_port; /* tcp port of nis_cachemgr */
- u_short udp_port; /* udp port of nis_cachemgr */
- u_long entries; /* Number of cached objs. */
- off_t used; /* How many space are used ? */
-};
-typedef struct cache_header cache_header;
-
-struct cache_spacer
-{
- u_long magic; /* Magic number */
- u_long hashval;
- time_t ctime; /* time we have created this object */
- time_t ttl; /* time to life of this object */
- off_t next_offset;
-};
-typedef struct cache_spacer cache_spacer;
-
-static int cache_fd = -1;
-static int clnt_sock;
-static caddr_t maddr = NULL;
-static size_t msize;
-static CLIENT *cache_clnt = NULL;
-
-/* If there is no cachemgr, we shouldn't use NIS_SHARED_DIRCACHE, if
- there is no NIS_SHARED_DIRCACHE, we couldn't use nis_cachemgr.
- So, if the clnt_call to nis_cachemgr fails, we also close the cache file.
- But another thread could read the cache => lock the cache_fd and cache_clnt
- variables with the same lock */
-__libc_lock_define_initialized (static, mgrlock)
-
-/* close file handles and nis_cachemgr connection */
-static void
-__cache_close (void)
-{
- if (cache_fd != -1)
- {
- close (cache_fd);
- cache_fd = -1;
- }
- if (cache_clnt != NULL)
- {
- clnt_destroy (cache_clnt);
- close (clnt_sock);
- cache_clnt = NULL;
- }
-}
-
-/* open the cache file and connect to nis_cachemgr */
-static bool_t
-__cache_open (void)
-{
- struct sockaddr_in sin;
- cache_header hptr;
-
- if ((cache_fd = open (CACHEFILE, O_RDONLY)) == -1)
- return FALSE;
-
- if (read (cache_fd, &hptr, sizeof (cache_header)) == -1
- || lseek (cache_fd, 0, SEEK_SET) < 0)
- {
- close (cache_fd);
- cache_fd = -1;
- return FALSE;
- }
- if (hptr.magic != HEADER_MAGIC)
- {
- close (cache_fd);
- cache_fd = -1;
- syslog (LOG_ERR, _("NIS+: cache file is corrupt!"));
- return FALSE;
- }
-
- memset (&sin, '\0', sizeof (sin));
- sin.sin_family = AF_INET;
- clnt_sock = RPC_ANYSOCK;
- sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
- sin.sin_port = htons (hptr.tcp_port);
- cache_clnt = clnttcp_create (&sin, CACHEPROG, CACHE_VER_1, &clnt_sock, 0, 0);
- if (cache_clnt == NULL)
- {
- close (cache_fd);
- cache_fd = -1;
- return FALSE;
- }
- /* If the program exists, close the socket */
- if (fcntl (clnt_sock, F_SETFD, FD_CLOEXEC) == -1)
- perror (_("fcntl: F_SETFD"));
- return TRUE;
-}
-
-/* Ask the cache manager to update directory 'name'
- for us (because the ttl has expired). */
-static nis_error
-__cache_refresh (nis_name name)
-{
- char clnt_res = 0;
- nis_error result = NIS_SUCCESS;
-
- __libc_lock_lock (mgrlock);
-
- if (cache_clnt == NULL)
- result = NIS_FAIL;
- else if (clnt_call (cache_clnt, NIS_CACHE_REFRESH_ENTRY,
- (xdrproc_t) xdr_wrapstring, (caddr_t) &name,
- (xdrproc_t) xdr_void, &clnt_res, TIMEOUT)
- != RPC_SUCCESS)
- {
- __cache_close ();
- result = NIS_FAIL;
- }
-
- __libc_lock_unlock (mgrlock);
-
- return result;
-}
-
-static nis_error
-__cache_find (const_nis_name name, directory_obj **obj)
-{
- unsigned long hash;
- struct cache_header *hptr;
- struct cache_spacer *cs;
- struct directory_obj *dir;
- XDR xdrs;
- caddr_t addr, ptr;
- time_t now = time (NULL);
-
- if (maddr == NULL)
- return NIS_FAIL;
-
- hash = __nis_hash (name, strlen(name));
- hptr = (cache_header *)maddr;
- if ((hptr->magic != HEADER_MAGIC) || (hptr->vers != CACHE_VERSION))
- {
- syslog (LOG_ERR, _("NIS+: cache file is corrupt!"));
- return NIS_SYSTEMERROR;
- }
- cs = (cache_spacer *)(maddr + sizeof (cache_header));
- while (cs->next_offset)
- {
- if (cs->magic != SPACER_MAGIC)
- {
- syslog (LOG_ERR, _("NIS+: cache file is corrupt!"));
- return NIS_SYSTEMERROR;
- }
- if (cs->hashval == hash)
- {
- if ((now - cs->ctime) > cs->ttl)
- return NIS_CACHEEXPIRED;
- dir = calloc (1, sizeof (directory_obj));
- addr = (caddr_t)cs + sizeof (cache_spacer);
- xdrmem_create (&xdrs, addr, cs->next_offset, XDR_DECODE);
- xdr_directory_obj (&xdrs, dir);
- xdr_destroy (&xdrs);
- *obj = dir;
- return NIS_SUCCESS;
- }
- ptr = (caddr_t)cs;
- ptr += cs->next_offset + sizeof (struct cache_spacer);
- cs = (struct cache_spacer *)ptr;
- }
- return NIS_NOTFOUND;
-}
-
-static directory_obj *
-internal_cache_search (const_nis_name name)
-{
- directory_obj *dir;
- nis_error res;
- int second_refresh = 0;
- struct stat s;
-
- if (cache_fd == -1)
- if (__cache_open () == FALSE)
- return NULL;
-
- again:
- /* This lock is for nis_cachemgr, so it couldn't write a new cache
- file if we reading it */
- if (__nis_lock_cache () == -1)
- return NULL;
-
- if (maddr != NULL)
- munmap (maddr, msize);
- if (fstat (cache_fd, &s) < 0)
- maddr = MAP_FAILED;
- else
- {
- msize = s.st_size;
- maddr = mmap (0, msize, PROT_READ, MAP_SHARED, cache_fd, 0);
- }
- if (maddr == MAP_FAILED)
- {
- __nis_unlock_cache ();
- return NULL;
- }
-
- res = __cache_find (name, &dir);
-
- munmap (maddr, msize);
- maddr = NULL;
- /* Allow nis_cachemgr to write a new cachefile */
- __nis_unlock_cache ();
-
- switch(res)
- {
- case NIS_CACHEEXPIRED:
- if (second_refresh)
- {
- __cache_close ();
- syslog (LOG_WARNING,
- _("NIS+: nis_cachemgr failed to refresh object for us"));
- return NULL;
- }
- ++second_refresh;
- if (__cache_refresh ((char *) name) != NIS_SUCCESS)
- return NULL;
- goto again;
- break;
- case NIS_SUCCESS:
- return dir;
- default:
- return NULL;
- }
-}
-
-directory_obj *
-__cache_search (const_nis_name name)
-{
- directory_obj *dir;
-
- __libc_lock_lock (mgrlock);
-
- dir = internal_cache_search (name);
-
- __libc_lock_unlock (mgrlock);
-
- return dir;
-}
-
-nis_error
-__cache_add (fd_result *fd)
-{
- char clnt_res = 0;
- nis_error result = NIS_SUCCESS;
-
- __libc_lock_lock (mgrlock);
-
- if (cache_clnt == NULL)
- if (__cache_open () == FALSE)
- result = NIS_FAIL;
-
- if (cache_clnt != NULL &&
- (clnt_call (cache_clnt, NIS_CACHE_ADD_ENTRY, (xdrproc_t) xdr_fd_result,
- (caddr_t)fd, (xdrproc_t) xdr_void, &clnt_res, TIMEOUT)
- != RPC_SUCCESS))
- {
- __cache_close ();
- result = NIS_RPCERROR;
- }
-
- __libc_lock_unlock (mgrlock);
-
- return result;
-}
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 06f63ee52e..aaefdd22ba 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -462,13 +462,12 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, u_long flags,
xdr_free((xdrproc_t)xdr_fd_result, (caddr_t)fd_res);
return NULL;
}
- __cache_add (fd_res);
obj = calloc(1, sizeof(directory_obj));
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
fd_res->dir_data.dir_data_len, XDR_DECODE);
xdr_directory_obj(&xdrs, obj);
xdr_destroy(&xdrs);
- xdr_free((xdrproc_t)xdr_fd_result, (caddr_t)fd_res);
+ __free_fdresult (fd_res);
if (obj != NULL)
{
/* We have found a NIS+ server serving ndomain, now
@@ -515,13 +514,12 @@ rec_dirsearch (const_nis_name name, directory_obj *dir, u_long flags,
xdr_free((xdrproc_t)xdr_fd_result, (caddr_t)fd_res);
return NULL;
}
- __cache_add (fd_res);
obj = calloc(1, sizeof(directory_obj));
xdrmem_create(&xdrs, fd_res->dir_data.dir_data_val,
fd_res->dir_data.dir_data_len, XDR_DECODE);
xdr_directory_obj(&xdrs, obj);
xdr_destroy(&xdrs);
- xdr_free((xdrproc_t)xdr_fd_result, (caddr_t)fd_res);
+ __free_fdresult (fd_res);
if (obj != NULL)
{
/* We have found a NIS+ server serving ndomain, now
@@ -554,9 +552,6 @@ __do_niscall (const_nis_name name, u_long prog, xdrproc_t xargs,
if (name == NULL)
return NIS_BADNAME;
- if ((flags & NO_CACHE) != NO_CACHE)
- dir = __cache_search (name);
-
if (dir == NULL)
{
nis_error status;
diff --git a/nis/nis_checkpoint.c b/nis/nis_checkpoint.c
index 15cdd58402..f4bd07252c 100644
--- a/nis/nis_checkpoint.c
+++ b/nis/nis_checkpoint.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_result *
@@ -35,26 +34,25 @@ nis_checkpoint(const_nis_name dirname)
u_int i;
res2 = nis_lookup (dirname, EXPAND_NAME);
- if (res2->status != NIS_SUCCESS && res2->status != NIS_S_SUCCESS)
+ if (NIS_RES_STATUS (res2) != NIS_SUCCESS)
return res2;
/* Check if obj is really a diryectory object */
- if (res2->objects.objects_val[0].zo_data.zo_type != DIRECTORY_OBJ)
+ if (__type_of (NIS_RES_OBJECT (res2)) != NIS_DIRECTORY_OBJ)
{
nis_freeresult (res);
- res->status = NIS_INVALIDOBJ;
+ NIS_RES_STATUS (res) = NIS_INVALIDOBJ;
return res;
}
for (i = 0;
- i < res2->objects.objects_val[0].DI_data.do_servers.do_servers_len;
- ++i)
+ i < NIS_RES_OBJECT (res2)->DI_data.do_servers.do_servers_len; ++i)
{
- if (__do_niscall2 (&res2->objects.objects_val[0].DI_data.do_servers.do_servers_val[i],
- 1, NIS_CHECKPOINT, (xdrproc_t) xdr_nis_name,
- (caddr_t) &dirname, (xdrproc_t) xdr_cp_result,
- (caddr_t) &cpres, 0, NULL) != RPC_SUCCESS)
- res->status = NIS_RPCERROR;
+ if (__do_niscall2 (&NIS_RES_OBJECT(res2)->DI_data.do_servers.do_servers_val[i],
+ 1, NIS_CHECKPOINT, (xdrproc_t) xdr_nis_name,
+ (caddr_t) &dirname, (xdrproc_t) xdr_cp_result,
+ (caddr_t) &cpres, 0, NULL) != RPC_SUCCESS)
+ NIS_RES_STATUS (res) = NIS_RPCERROR;
else
{
res->status += cpres->cp_status;
@@ -65,7 +63,7 @@ nis_checkpoint(const_nis_name dirname)
nis_freeresult (res2);
}
else
- res->status = NIS_NOSUCHNAME;
+ NIS_RES_STATUS (res) = NIS_NOSUCHNAME;
return res;
}
diff --git a/nis/nis_clone.c b/nis/nis_clone.c
deleted file mode 100644
index a1d753692c..0000000000
--- a/nis/nis_clone.c
+++ /dev/null
@@ -1,573 +0,0 @@
-/* Copyright (c) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <string.h>
-#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
-
-directory_obj *
-nis_clone_directory (const directory_obj *src, directory_obj *dest)
-{
- directory_obj *res;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (directory_obj));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- if (src->do_name)
- res->do_name = strdup (src->do_name);
- else
- res->do_name = NULL;
- res->do_type = src->do_type;
- if (src->do_servers.do_servers_len > 0)
- {
- size_t i;
-
- res->do_servers.do_servers_len = src->do_servers.do_servers_len;
- if ((res->do_servers.do_servers_val =
- malloc (src->do_servers.do_servers_len * sizeof (nis_server)))
- == NULL)
- return NULL;
-
- for (i = 0; i < src->do_servers.do_servers_len; ++i)
- {
- if (src->do_servers.do_servers_val[i].name != NULL)
- res->do_servers.do_servers_val[i].name =
- strdup (src->do_servers.do_servers_val[i].name);
- else
- res->do_servers.do_servers_val[i].name = NULL;
-
- res->do_servers.do_servers_val[i].ep.ep_len =
- src->do_servers.do_servers_val[i].ep.ep_len;
- if (res->do_servers.do_servers_val[i].ep.ep_len > 0)
- {
- size_t j;
-
- res->do_servers.do_servers_val[i].ep.ep_val =
- malloc (src->do_servers.do_servers_val[i].ep.ep_len *
- sizeof (endpoint));
- for (j = 0; j < res->do_servers.do_servers_val[i].ep.ep_len; ++j)
- {
- if (src->do_servers.do_servers_val[i].ep.ep_val[j].uaddr)
- res->do_servers.do_servers_val[i].ep.ep_val[j].uaddr
- = strdup (src->do_servers.do_servers_val[i].ep.ep_val[j].uaddr);
- else
- res->do_servers.do_servers_val[i].ep.ep_val[j].uaddr = NULL;
-
- if (src->do_servers.do_servers_val[i].ep.ep_val[j].family)
- res->do_servers.do_servers_val[i].ep.ep_val[j].family
- = strdup (src->do_servers.do_servers_val[i].ep.ep_val[j].family);
- else
- res->do_servers.do_servers_val[i].ep.ep_val[j].family = NULL;
-
- if (src->do_servers.do_servers_val[i].ep.ep_val[j].proto)
- res->do_servers.do_servers_val[i].ep.ep_val[j].proto
- = strdup (src->do_servers.do_servers_val[i].ep.ep_val[j].proto);
- else
- res->do_servers.do_servers_val[i].ep.ep_val[j].proto = NULL;
- }
- }
- else
- {
- res->do_servers.do_servers_val[i].ep.ep_val = NULL;
- }
- res->do_servers.do_servers_val[i].key_type =
- src->do_servers.do_servers_val[i].key_type;
- res->do_servers.do_servers_val[i].pkey.n_len =
- src->do_servers.do_servers_val[i].pkey.n_len;
- if (res->do_servers.do_servers_val[i].pkey.n_len > 0)
- {
- res->do_servers.do_servers_val[i].pkey.n_bytes =
- malloc (src->do_servers.do_servers_val[i].pkey.n_len);
- if (res->do_servers.do_servers_val[i].pkey.n_bytes == NULL)
- return NULL;
- memcpy (res->do_servers.do_servers_val[i].pkey.n_bytes,
- src->do_servers.do_servers_val[i].pkey.n_bytes,
- src->do_servers.do_servers_val[i].pkey.n_len);
- }
- else
- res->do_servers.do_servers_val[i].pkey.n_bytes = NULL;
- }
- }
- else
- {
- res->do_servers.do_servers_len = 0;
- res->do_servers.do_servers_val = NULL;
- }
- res->do_ttl = src->do_ttl;
- res->do_armask.do_armask_len = src->do_armask.do_armask_len;
- if (res->do_armask.do_armask_len > 0)
- {
- if ((res->do_armask.do_armask_val =
- malloc (src->do_armask.do_armask_len * sizeof (oar_mask))) == NULL)
- return NULL;
- memcpy (res->do_armask.do_armask_val, src->do_armask.do_armask_val,
- src->do_armask.do_armask_len * sizeof (oar_mask));
- }
- else
- {
- res->do_armask.do_armask_val = NULL;
- }
-
- return res;
-}
-
-group_obj *
-nis_clone_group (const group_obj *src, group_obj *dest)
-{
- size_t i;
- group_obj *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (group_obj));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- res->gr_flags = src->gr_flags;
-
- res->gr_members.gr_members_len = src->gr_members.gr_members_len;
- if (res->gr_members.gr_members_len > 0)
- {
- if (res->gr_members.gr_members_val == NULL)
- {
- if ((res->gr_members.gr_members_val =
- malloc (res->gr_members.gr_members_len * sizeof (nis_name))) == NULL)
- return NULL;
- }
- for (i = 0; i < res->gr_members.gr_members_len; ++i)
- if (src->gr_members.gr_members_val[i] != NULL)
- res->gr_members.gr_members_val[i] =
- strdup (src->gr_members.gr_members_val[i]);
- else
- res->gr_members.gr_members_val[i] = NULL;
- }
-
- return res;
-}
-
-table_obj *
-nis_clone_table (const table_obj *src, table_obj *dest)
-{
- size_t i;
- table_obj *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (table_obj));
- if (res == NULL)
- return res;
- }
- else
- res = dest;
-
- if (src->ta_type != NULL)
- {
- if ((res->ta_type = strdup (src->ta_type)) == NULL)
- return NULL;
- }
- else
- res->ta_type = NULL;
-
- res->ta_maxcol = src->ta_maxcol;
- res->ta_sep = src->ta_sep;
- res->ta_cols.ta_cols_len = src->ta_cols.ta_cols_len;
- if (res->ta_cols.ta_cols_val == NULL)
- {
- if ((res->ta_cols.ta_cols_val =
- calloc (1, src->ta_cols.ta_cols_len * sizeof (table_col))) == NULL)
- return NULL;
- }
- for (i = 0; i < res->ta_cols.ta_cols_len; i++)
- {
- if (src->ta_cols.ta_cols_val[i].tc_name == NULL)
- res->ta_cols.ta_cols_val[i].tc_name = NULL;
- else
- res->ta_cols.ta_cols_val[i].tc_name =
- strdup (src->ta_cols.ta_cols_val[i].tc_name);
- res->ta_cols.ta_cols_val[i].tc_flags =
- src->ta_cols.ta_cols_val[i].tc_flags;
- res->ta_cols.ta_cols_val[i].tc_rights =
- src->ta_cols.ta_cols_val[i].tc_rights;
- }
-
- if (src->ta_path != NULL)
- {
- if ((res->ta_path = strdup (src->ta_path)) == NULL)
- return NULL;
- }
- else
- res->ta_path = NULL;
-
- return res;
-}
-
-entry_obj *
-nis_clone_entry (const entry_obj *src, entry_obj *dest)
-{
- size_t i;
- entry_obj *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (entry_obj));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- if (src->en_type)
- res->en_type = strdup (src->en_type);
- else
- res->en_type = NULL;
-
- res->en_cols.en_cols_len = src->en_cols.en_cols_len;
- if (res->en_cols.en_cols_val == NULL && src->en_cols.en_cols_len > 0)
- {
- res->en_cols.en_cols_val =
- calloc (1, src->en_cols.en_cols_len * sizeof (entry_col));
- if (res->en_cols.en_cols_val == NULL)
- return NULL;
- }
- for (i = 0; i < res->en_cols.en_cols_len; ++i)
- {
- res->en_cols.en_cols_val[i].ec_flags =
- src->en_cols.en_cols_val[i].ec_flags;
- res->en_cols.en_cols_val[i].ec_value.ec_value_len =
- src->en_cols.en_cols_val[i].ec_value.ec_value_len;
- if (res->en_cols.en_cols_val[i].ec_value.ec_value_val == NULL &&
- src->en_cols.en_cols_val[i].ec_value.ec_value_len > 0)
- res->en_cols.en_cols_val[i].ec_value.ec_value_val =
- malloc (src->en_cols.en_cols_val[i].ec_value.ec_value_len);
- memcpy (res->en_cols.en_cols_val[i].ec_value.ec_value_val,
- src->en_cols.en_cols_val[i].ec_value.ec_value_val,
- res->en_cols.en_cols_val[i].ec_value.ec_value_len);
- }
-
- return res;
-}
-
-nis_attr *
-nis_clone_nis_attr (const nis_attr *src, nis_attr *dest)
-{
- nis_attr *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (nis_attr));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- if (src->zattr_ndx != NULL)
- {
- if ((res->zattr_ndx = strdup (src->zattr_ndx)) == NULL)
- return NULL;
- }
- else
- res->zattr_ndx = NULL;
-
- res->zattr_val.zattr_val_len = src->zattr_val.zattr_val_len;
- if (res->zattr_val.zattr_val_len > 0)
- {
- if (res->zattr_val.zattr_val_val == NULL)
- {
- if ((res->zattr_val.zattr_val_val =
- calloc (1, src->zattr_val.zattr_val_len)) == NULL)
- return NULL;
- }
- memcpy (res->zattr_val.zattr_val_val, src->zattr_val.zattr_val_val,
- src->zattr_val.zattr_val_len);
- }
- else
- res->zattr_val.zattr_val_val = NULL;
- return res;
-}
-
-static nis_attr *
-__nis_clone_attrs (const nis_attr *src, nis_attr *dest, u_int len)
-{
- unsigned int i;
- nis_attr *res;
-
- if (len == 0)
- return dest;
-
- if (dest == NULL)
- {
- res = calloc (len, sizeof (nis_attr));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- for (i = 0; i < len; i++)
- nis_clone_nis_attr(&src[i], &res[i]);
-
- return res;
-}
-
-link_obj *
-nis_clone_link (const link_obj *src, link_obj *dest)
-{
- link_obj *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (link_obj));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- res->li_rtype = src->li_rtype;
-
- res->li_attrs.li_attrs_len = src->li_attrs.li_attrs_len;
- res->li_attrs.li_attrs_val =
- __nis_clone_attrs (src->li_attrs.li_attrs_val,
- res->li_attrs.li_attrs_val,
- src->li_attrs.li_attrs_len);
-
- if (src->li_name)
- {
- if ((res->li_name = strdup (src->li_name)) == NULL)
- return NULL;
- }
- else
- res->li_name = NULL;
-
- return res;
-}
-
-objdata *
-nis_clone_objdata (const objdata *src, objdata *dest)
-{
- objdata *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (objdata));
- if (res == NULL)
- return res;
- }
- else
- res = dest;
-
- res->zo_type = src->zo_type;
-
- switch (src->zo_type)
- {
- case BOGUS_OBJ:
- break;
- case NO_OBJ:
- break;
- case DIRECTORY_OBJ:
- if (nis_clone_directory (&src->objdata_u.di_data,
- &res->objdata_u.di_data) == NULL)
- return NULL;
- break;
- case GROUP_OBJ:
- if (nis_clone_group (&src->objdata_u.gr_data,
- &res->objdata_u.gr_data) == NULL)
- return NULL;
- break;
- case TABLE_OBJ:
- if (nis_clone_table (&src->objdata_u.ta_data,
- &res->objdata_u.ta_data) == NULL)
- return NULL;
- break;
- case ENTRY_OBJ:
- if (nis_clone_entry (&src->objdata_u.en_data,
- &res->objdata_u.en_data) == NULL)
- return NULL;
- break;
- case LINK_OBJ:
- if (nis_clone_link (&src->objdata_u.li_data,
- &res->objdata_u.li_data) == NULL)
- return NULL;
- break;
- case PRIVATE_OBJ:
- res->objdata_u.po_data.po_data_len =
- src->objdata_u.po_data.po_data_len;
- if (src->objdata_u.po_data.po_data_val)
- {
- if ((res->objdata_u.po_data.po_data_val =
- malloc (res->objdata_u.po_data.po_data_len)) == NULL)
- return NULL;
- memcpy (res->objdata_u.po_data.po_data_val,
- src->objdata_u.po_data.po_data_val,
- src->objdata_u.po_data.po_data_len);
- }
- else
- {
- res->objdata_u.po_data.po_data_val = NULL;
- res->objdata_u.po_data.po_data_len = 0;
- }
- break;
- default:
- return NULL;
- }
-
- return res;
-}
-
-nis_object *
-nis_clone_object (const nis_object *src, nis_object *dest)
-{
- nis_object *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (nis_object));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- res->zo_oid = src->zo_oid;
-
- if (src->zo_name)
- {
- if ((res->zo_name = strdup (src->zo_name)) == NULL)
- return NULL;
- }
- else
- res->zo_name = NULL;
- if (src->zo_owner)
- {
- if ((res->zo_owner = strdup (src->zo_owner)) == NULL)
- return NULL;
- }
- else
- res->zo_owner = NULL;
- if (src->zo_group)
- {
- if ((res->zo_group = strdup (src->zo_group)) == NULL)
- return NULL;
- }
- else
- res->zo_group = NULL;
- if (src->zo_domain)
- {
- if ((res->zo_domain = strdup (src->zo_domain)) == NULL)
- return NULL;
- }
- else
- res->zo_domain = NULL;
- res->zo_access = src->zo_access;
- res->zo_ttl = src->zo_ttl;
-
- if (nis_clone_objdata (&src->zo_data, &res->zo_data) == NULL)
- return NULL;
-
- return res;
-}
-
-static nis_object *
-__nis_clone_objects (const nis_object *src, nis_object *dest, u_int len)
-{
- unsigned int i;
- nis_object *res;
-
- if (len == 0)
- return dest;
-
- if (dest == NULL)
- {
- res = calloc (len, sizeof (nis_object));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- for (i = 0; i < len; ++i)
- nis_clone_object(&src[i], &res[i]);
-
- return res;
-}
-
-nis_result *
-nis_clone_result (const nis_result *src, nis_result *dest)
-{
- nis_result *res = NULL;
-
- if (src == NULL)
- return NULL;
-
- if (dest == NULL)
- {
- res = calloc (1, sizeof (nis_result));
- if (res == NULL)
- return NULL;
- }
- else
- res = dest;
-
- res->status = src->status;
- res->objects.objects_len = src->objects.objects_len;
- res->objects.objects_val =
- __nis_clone_objects (src->objects.objects_val,
- res->objects.objects_val,
- src->objects.objects_len);
- res->zticks = src->zticks;
- res->dticks = src->dticks;
- res->aticks = src->aticks;
- res->cticks = src->cticks;
-
- return res;
-}
diff --git a/nis/nis_clone_dir.c b/nis/nis_clone_dir.c
new file mode 100644
index 0000000000..4d641e58f7
--- /dev/null
+++ b/nis/nis_clone_dir.c
@@ -0,0 +1,69 @@
+/* Copyright (c) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <string.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/nis.h>
+
+directory_obj *
+nis_clone_directory (const directory_obj *src, directory_obj *dest)
+{
+ unsigned char *addr;
+ unsigned int size;
+ XDR xdrs;
+ directory_obj *res;
+
+ if (src == NULL)
+ return (NULL);
+
+ size = xdr_sizeof ((xdrproc_t)xdr_directory_obj, (char *)src);
+ if ((addr = calloc(1, size)) == NULL)
+ return NULL;
+
+ if (dest == NULL)
+ {
+ if ((res = calloc (1, sizeof (directory_obj))) == NULL)
+ {
+ free (addr);
+ return NULL;
+ }
+ }
+ else
+ res = dest;
+
+ xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
+ if (!xdr_directory_obj (&xdrs, (directory_obj *)src))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ xdrmem_create (&xdrs, addr, size, XDR_DECODE);
+ if (!xdr_directory_obj (&xdrs, res))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ free (addr);
+
+ return res;
+}
diff --git a/nis/nis_clone_obj.c b/nis/nis_clone_obj.c
new file mode 100644
index 0000000000..291148fc0f
--- /dev/null
+++ b/nis/nis_clone_obj.c
@@ -0,0 +1,69 @@
+/* Copyright (c) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <string.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/nis.h>
+
+nis_object *
+nis_clone_object (const nis_object *src, nis_object *dest)
+{
+ unsigned char *addr;
+ unsigned int size;
+ XDR xdrs;
+ nis_object *res;
+
+ if (src == NULL)
+ return (NULL);
+
+ size = xdr_sizeof ((xdrproc_t)xdr_nis_object, (char *)src);
+ if ((addr = calloc(1, size)) == NULL)
+ return NULL;
+
+ if (dest == NULL)
+ {
+ if ((res = calloc (1, sizeof (nis_object))) == NULL)
+ {
+ free (addr);
+ return NULL;
+ }
+ }
+ else
+ res = dest;
+
+ xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
+ if (!xdr_nis_object (&xdrs, (nis_object *)src))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ xdrmem_create(&xdrs, addr, size, XDR_DECODE);
+ if (!xdr_nis_object(&xdrs, res))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ free (addr);
+
+ return res;
+}
diff --git a/nis/nis_clone_res.c b/nis/nis_clone_res.c
new file mode 100644
index 0000000000..9bdc4d8835
--- /dev/null
+++ b/nis/nis_clone_res.c
@@ -0,0 +1,69 @@
+/* Copyright (c) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <string.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/nis.h>
+
+nis_result *
+nis_clone_result (const nis_result *src, nis_result *dest)
+{
+ unsigned char *addr;
+ unsigned int size;
+ XDR xdrs;
+ nis_result *res;
+
+ if (src == NULL)
+ return (NULL);
+
+ size = xdr_sizeof ((xdrproc_t)xdr_nis_result, (char *)src);
+ if ((addr = calloc(1, size)) == NULL)
+ return NULL;
+
+ if (dest == NULL)
+ {
+ if ((res = calloc (1, sizeof (nis_result))) == NULL)
+ {
+ free (addr);
+ return NULL;
+ }
+ }
+ else
+ res = dest;
+
+ xdrmem_create(&xdrs, addr, size, XDR_ENCODE);
+ if (!xdr_nis_result (&xdrs, (nis_result *)src))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ xdrmem_create(&xdrs, addr, size, XDR_DECODE);
+ if (!xdr_nis_result(&xdrs, res))
+ {
+ xdr_destroy (&xdrs);
+ free (addr);
+ return NULL;
+ }
+ xdr_destroy (&xdrs);
+ free (addr);
+
+ return res;
+}
diff --git a/nis/nis_creategroup.c b/nis/nis_creategroup.c
index d1de08c08d..240573145f 100644
--- a/nis/nis_creategroup.c
+++ b/nis/nis_creategroup.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_creategroup (const_nis_name group, u_long flags)
@@ -50,7 +49,7 @@ nis_creategroup (const_nis_name group, u_long flags)
obj->zo_group = strdup (__nis_default_group (NULL));
obj->zo_access = __nis_default_access (NULL, 0);
obj->zo_ttl = __nis_default_ttl (0);
- obj->zo_data.zo_type = GROUP_OBJ;
+ obj->zo_data.zo_type = NIS_GROUP_OBJ;
obj->zo_data.objdata_u.gr_data.gr_flags = flags;
obj->zo_data.objdata_u.gr_data.gr_members.gr_members_len = 0;
obj->zo_data.objdata_u.gr_data.gr_members.gr_members_val = NULL;
diff --git a/nis/nis_defaults.c b/nis/nis_defaults.c
index 53a585b516..21a80506ff 100644
--- a/nis/nis_defaults.c
+++ b/nis/nis_defaults.c
@@ -23,7 +23,6 @@
#include <sys/types.h>
#include <rpc/rpc.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#define DEFAULT_TTL 43200
@@ -33,8 +32,7 @@
static nis_name
searchgroup (char *str)
{
- static char default_group[NIS_MAXNAMELEN];
- char *cptr;
+ char *cptr;
int i;
cptr = strstr (str, "group=");
@@ -48,13 +46,12 @@ searchgroup (char *str)
if (i == 0) /* only "group=" ? */
return (nis_name) "";
- return strncpy (default_group, cptr, i);
+ return strndup (cptr, i);
}
static nis_name
searchowner (char *str)
{
- static char default_owner[NIS_MAXNAMELEN];
char *cptr;
int i;
@@ -67,9 +64,9 @@ searchowner (char *str)
while (cptr[i] != '\0' && cptr[i] != ':')
i++;
if (i == 0) /* only "owner=" ? */
- return (nis_name)"";
+ return strdup ("");
- return strncpy (default_owner, cptr, i);
+ return strndup (cptr, i);
}
static u_long
@@ -134,9 +131,9 @@ searchttl (char *str)
static u_long
searchaccess (char *str, u_long access)
{
- static char buf[NIS_MAXNAMELEN];
+ char buf[NIS_MAXNAMELEN];
char *cptr;
- u_long result;
+ u_long result = access;
int i;
int n, o, g, w;
@@ -153,7 +150,7 @@ searchaccess (char *str, u_long access)
strncpy (buf, cptr, i);
- result = n = o = g = w = 0;
+ n = o = g = w = 0;
cptr = buf;
while (*cptr != '\0')
{
@@ -221,11 +218,11 @@ searchaccess (char *str, u_long access)
result = result & ~(NIS_DESTROY_ACC);
break;
default:
- fprintf (stderr, "Parse error in \"%s\"\n", buf);
- return 0;
+ return ULONG_MAX;
}
cptr++;
}
+ n = o = g = w = 0;
break;
case '+':
cptr++; /* Remove "=" from beginning */
@@ -274,11 +271,11 @@ searchaccess (char *str, u_long access)
result = result | (NIS_DESTROY_ACC);
break;
default:
- fprintf (stderr, "Parse error in \"%s\"\n", buf);
- return 0;
+ return ULONG_MAX;
}
cptr++;
}
+ n = o = g = w = 0;
break;
case '=':
cptr++; /* Remove "=" from beginning */
@@ -341,26 +338,25 @@ searchaccess (char *str, u_long access)
result = result | (NIS_DESTROY_ACC);
break;
default:
- fprintf (stderr, "Parse error in \"%s\"\n", buf);
- return 0;
+ return result = ULONG_MAX;
}
cptr++;
}
+ n = o = g = w = 0;
break;
default:
- fprintf (stderr, "Parse error in \"%s\"\n", buf);
- return 0;
+ return result = ULONG_MAX;
}
cptr++;
}
- return 0;
+ return result;
}
nis_name
__nis_default_owner (char *defaults)
{
- static char default_owner[NIS_MAXNAMELEN];
+ char default_owner[NIS_MAXNAMELEN];
char *cptr, *dptr;
strcpy (default_owner, nis_local_principal ());
@@ -369,7 +365,11 @@ __nis_default_owner (char *defaults)
{
dptr = strstr (defaults, "owner=");
if (dptr != NULL)
- strcpy (default_owner, searchowner (defaults));
+ {
+ char *p = searchowner (defaults);
+ strcpy (default_owner, p);
+ free (p);
+ }
}
else
{
@@ -378,17 +378,21 @@ __nis_default_owner (char *defaults)
{
dptr = strstr (cptr, "owner=");
if (dptr != NULL)
- strcpy (default_owner, searchowner (cptr));
+ {
+ char *p = searchowner (cptr);
+ strcpy (default_owner, p);
+ free (p);
+ }
}
}
- return default_owner;
+ return strdup (default_owner);
}
nis_name
__nis_default_group (char *defaults)
{
- static char default_group[NIS_MAXNAMELEN];
+ char default_group[NIS_MAXNAMELEN];
char *cptr, *dptr;
strcpy (default_group, nis_local_group ());
@@ -397,7 +401,11 @@ __nis_default_group (char *defaults)
{
dptr = strstr (defaults, "group=");
if (dptr != NULL)
- strcpy (default_group, searchgroup (defaults));
+ {
+ char *p = searchgroup (defaults);
+ strcpy (default_group, p);
+ free (p);
+ }
}
else
{
@@ -406,11 +414,15 @@ __nis_default_group (char *defaults)
{
dptr = strstr (cptr, "group=");
if (dptr != NULL)
- strcpy (default_group, searchgroup (cptr));
+ {
+ char *p = searchgroup (cptr);
+ strcpy (default_group, p);
+ free (p);
+ }
}
}
- return default_group;
+ return strdup (default_group);
}
u_long
diff --git a/nis/nis_destroygroup.c b/nis/nis_destroygroup.c
index 6ece45345d..5b70a67b68 100644
--- a/nis/nis_destroygroup.c
+++ b/nis/nis_destroygroup.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_destroygroup (const_nis_name group)
@@ -42,7 +41,7 @@ nis_destroygroup (const_nis_name group)
stpcpy (cp, cp2);
}
res = nis_remove (buf, NULL);
- status = res->status;
+ status = NIS_RES_STATUS (res);
nis_freeresult (res);
return status;
}
diff --git a/nis/nis_domain_of.c b/nis/nis_domain_of.c
index f0cfe316e6..f6cca815b4 100644
--- a/nis/nis_domain_of.c
+++ b/nis/nis_domain_of.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_name
nis_domain_of (const_nis_name name)
diff --git a/nis/nis_domain_of_r.c b/nis/nis_domain_of_r.c
index 3435233aef..00238d0693 100644
--- a/nis/nis_domain_of_r.c
+++ b/nis/nis_domain_of_r.c
@@ -20,7 +20,6 @@
#include <errno.h>
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_name
nis_domain_of_r (const_nis_name name, char *buffer, size_t buflen)
diff --git a/nis/nis_error.c b/nis/nis_error.c
index 6ed1cc914a..ced0f716fd 100644
--- a/nis/nis_error.c
+++ b/nis/nis_error.c
@@ -21,7 +21,6 @@
#include <syslog.h>
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
static const char *nis_errlist[] =
diff --git a/nis/nis_file.c b/nis/nis_file.c
index c32d54a622..fdd7cd4214 100644
--- a/nis/nis_file.c
+++ b/nis/nis_file.c
@@ -21,8 +21,6 @@
#include <stdlib.h>
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
-
static const char cold_start_file[] = "/var/nis/NIS_COLD_START";
diff --git a/nis/nis_free.c b/nis/nis_free.c
index a4ab7378e6..5d08882f84 100644
--- a/nis/nis_free.c
+++ b/nis/nis_free.c
@@ -18,317 +18,53 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
void
-nis_free_attr (nis_attr *obj)
+__free_fdresult (fd_result *res)
{
- if (obj == NULL)
- return;
-
- if (obj->zattr_ndx)
- {
- free (obj->zattr_ndx);
- obj->zattr_ndx = NULL;
- }
-
- if (obj->zattr_val.zattr_val_val)
+ if (res != NULL)
{
- free (obj->zattr_val.zattr_val_val);
- obj->zattr_val.zattr_val_val = NULL;
- obj->zattr_val.zattr_val_len = 0;
+ xdr_free ((xdrproc_t)xdr_fd_result, (char *)res);
+ free (res);
}
}
void
nis_free_request (ib_request *ibreq)
{
- unsigned int i;
-
- for (i = 0; i < ibreq->ibr_srch.ibr_srch_len; ++i)
- {
- nis_free_attr (&(ibreq->ibr_srch.ibr_srch_val)[i]);
- ibreq->ibr_srch.ibr_srch_val = NULL;
- ibreq->ibr_srch.ibr_srch_len = 0;
- }
-
- if (ibreq->ibr_name)
- {
- free (ibreq->ibr_name);
- ibreq->ibr_name = NULL;
- }
-
- if (ibreq->ibr_cookie.n_bytes)
- {
- free (ibreq->ibr_cookie.n_bytes);
- ibreq->ibr_cookie.n_bytes = NULL;
- ibreq->ibr_cookie.n_len = 0;
- }
-}
-
-void
-nis_free_endpoints (endpoint *ep, unsigned int len)
-{
- unsigned int i;
-
- if (ep == NULL)
- return;
-
- for (i = 0; i < len; ++i)
- {
- if (ep[i].uaddr)
- {
- free (ep[i].uaddr);
- ep[i].uaddr = NULL;
- }
- if (ep[i].family)
- {
- free (ep[i].family);
- ep[i].family = NULL;
- }
- if (ep[i].proto)
- {
- free (ep[i].proto);
- ep[i].proto = NULL;
- }
- }
-}
-
-void
-nis_free_servers (nis_server *obj, unsigned int len)
-{
- unsigned int i;
-
- if (obj == NULL)
- return;
-
- for (i = 0; i < len; i++)
+ if (ibreq != NULL)
{
- if (obj[i].name)
- {
- free (obj[i].name);
- obj[i].name = NULL;
- }
- if (obj[i].ep.ep_len > 0)
- {
- nis_free_endpoints (obj[i].ep.ep_val, obj[i].ep.ep_len);
- free (obj[i].ep.ep_val);
- obj[i].ep.ep_val = NULL;
- obj[i].ep.ep_len = 0;
- }
- if (obj[i].pkey.n_bytes && obj[i].pkey.n_len > 0)
- {
- free (obj[i].pkey.n_bytes);
- obj[i].pkey.n_bytes = NULL;
- obj[i].pkey.n_len = 0;
- }
+ xdr_free ((xdrproc_t)xdr_ib_request, (char *)ibreq);
+ free (ibreq);
}
}
void
nis_free_directory (directory_obj *obj)
{
- if (obj == NULL)
- return;
- if (obj->do_name)
- {
- free (obj->do_name);
- obj->do_name = NULL;
- }
- if (obj->do_servers.do_servers_len > 0)
+ if (obj != NULL)
{
- nis_free_servers (obj->do_servers.do_servers_val,
- obj->do_servers.do_servers_len);
- free (obj->do_servers.do_servers_val);
- obj->do_servers.do_servers_val = NULL;
- obj->do_servers.do_servers_len = 0;
- }
- if (obj->do_armask.do_armask_len > 0)
- {
- free (obj->do_armask.do_armask_val);
- obj->do_armask.do_armask_val = NULL;
- obj->do_armask.do_armask_len = 0;
- }
-}
-
-void
-nis_free_group (group_obj *obj)
-{
- unsigned int i;
-
- if (obj->gr_members.gr_members_len > 0)
- {
- for (i = 0; i < obj->gr_members.gr_members_len; ++i)
- if (obj->gr_members.gr_members_val[i])
- free (obj->gr_members.gr_members_val[i]);
- free (obj->gr_members.gr_members_val);
- obj->gr_members.gr_members_val = NULL;
- obj->gr_members.gr_members_len = 0;
- }
-}
-
-void
-nis_free_table (table_obj *obj)
-{
- if (obj == NULL)
- return;
-
- if (obj->ta_type)
- {
- free (obj->ta_type);
- obj->ta_type = NULL;
- }
-
- if (obj->ta_cols.ta_cols_val)
- {
- unsigned int i;
-
- for (i = 0; i < obj->ta_cols.ta_cols_len; ++i)
- if (obj->ta_cols.ta_cols_val[i].tc_name)
- free (obj->ta_cols.ta_cols_val[i].tc_name);
- free (obj->ta_cols.ta_cols_val);
- obj->ta_cols.ta_cols_val = NULL;
- obj->ta_cols.ta_cols_len = 0;
- }
-
- if (obj->ta_path)
- {
- free (obj->ta_path);
- obj->ta_path = NULL;
- }
-}
-
-void
-nis_free_entry (entry_obj *obj)
-{
- if (obj == NULL)
- return;
-
- if (obj->en_type)
- {
- free (obj->en_type);
- obj->en_type = 0;
- }
-
- if (obj->en_cols.en_cols_val)
- {
- unsigned int i;
-
- for (i = 0; i < obj->en_cols.en_cols_len; ++i)
- if (obj->en_cols.en_cols_val[i].ec_value.ec_value_val)
- free (obj->en_cols.en_cols_val[i].ec_value.ec_value_val);
- free (obj->en_cols.en_cols_val);
- obj->en_cols.en_cols_val = NULL;
- obj->en_cols.en_cols_len = 0;
- }
-}
-
-void
-nis_free_link (link_obj *obj)
-{
- if (obj == NULL)
- return;
-
- if (obj->li_attrs.li_attrs_val)
- {
- unsigned int i;
-
- for (i = 0; i < obj->li_attrs.li_attrs_len; ++i)
- {
- if (obj->li_attrs.li_attrs_val[i].zattr_ndx)
- free (obj->li_attrs.li_attrs_val[i].zattr_ndx);
- if (obj->li_attrs.li_attrs_val[i].zattr_val.zattr_val_val)
- free (obj->li_attrs.li_attrs_val[i].zattr_val.zattr_val_val);
- }
- free (obj->li_attrs.li_attrs_val);
- obj->li_attrs.li_attrs_val = NULL;
- obj->li_attrs.li_attrs_len = 0;
- }
-
- if (obj->li_name)
- {
- free (obj->li_name);
- obj->li_name = NULL;
+ xdr_free ((xdrproc_t)xdr_directory_obj, (char *)obj);
+ free (obj);
}
}
void
nis_free_object (nis_object *obj)
{
-
- if (obj == NULL)
- return;
-
- if (obj->zo_name)
- {
- free (obj->zo_name);
- obj->zo_name = NULL;
- }
- if (obj->zo_owner)
- {
- free (obj->zo_owner);
- obj->zo_owner = NULL;
- }
- if (obj->zo_group)
+ if (obj != NULL)
{
- free (obj->zo_group);
- obj->zo_group = NULL;
+ xdr_free ((xdrproc_t)xdr_nis_object, (char *)obj);
+ free (obj);
}
- if (obj->zo_domain)
- {
- free (obj->zo_domain);
- obj->zo_domain = NULL;
- }
- switch (obj->zo_data.zo_type)
- {
- case BOGUS_OBJ:
- break;
- case NO_OBJ:
- break;
- case DIRECTORY_OBJ:
- nis_free_directory (&obj->zo_data.objdata_u.di_data);
- break;
- case GROUP_OBJ:
- nis_free_group (&obj->zo_data.objdata_u.gr_data);
- break;
- case TABLE_OBJ:
- nis_free_table (&obj->zo_data.objdata_u.ta_data);
- break;
- case ENTRY_OBJ:
- nis_free_entry (&obj->zo_data.objdata_u.en_data);
- break;
- case LINK_OBJ:
- nis_free_link (&obj->zo_data.objdata_u.li_data);
- break;
- case PRIVATE_OBJ:
- if (obj->zo_data.objdata_u.po_data.po_data_val)
- {
- free (obj->zo_data.objdata_u.po_data.po_data_val);
- obj->zo_data.objdata_u.po_data.po_data_val = NULL;
- }
- break;
- default:
- break;
- }
- obj->zo_data.zo_type = NO_OBJ;
}
void
nis_freeresult (nis_result *res)
{
- unsigned int i;
-
- if (res == NULL)
- return;
-
- for (i = 0; i < res->objects.objects_len; i++)
- nis_free_object (&(res->objects.objects_val)[i]);
-
- if (res->objects.objects_val != NULL)
- free (res->objects.objects_val);
-
- if (res->cookie.n_bytes != NULL && res->cookie.n_len > 0)
- free (res->cookie.n_bytes);
-
- free (res);
+ if (res != NULL)
+ {
+ xdr_free ((xdrproc_t)xdr_nis_result, (char *)res);
+ free (res);
+ }
}
diff --git a/nis/nis_getservlist.c b/nis/nis_getservlist.c
index b30b70b584..1629c24053 100644
--- a/nis/nis_getservlist.c
+++ b/nis/nis_getservlist.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_server **
@@ -30,19 +29,21 @@ nis_getservlist (const_nis_name dir)
res = nis_lookup (dir, FOLLOW_LINKS);
- if (res->status == NIS_SUCCESS || res->status == NIS_S_SUCCESS)
+ if (NIS_RES_STATUS (res) == NIS_SUCCESS)
{
unsigned long i;
nis_server *server;
- serv = calloc (1, sizeof (nis_server *) *
- (res->objects.objects_val->DI_data.do_servers.do_servers_len + 1));
+ serv =
+ calloc (1, sizeof (nis_server *) *
+ (NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len + 1));
if (serv == NULL)
return NULL;
- for (i = 0; i < res->objects.objects_val->DI_data.do_servers.do_servers_len; ++i)
+ for (i = 0; i < NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_len;
+ ++i)
{
server =
- &res->objects.objects_val->DI_data.do_servers.do_servers_val[i];
+ &NIS_RES_OBJECT (res)->DI_data.do_servers.do_servers_val[i];
serv[i] = calloc (1, sizeof (nis_server));
if (server->name != NULL)
serv[i]->name = strdup (server->name);
@@ -110,7 +111,7 @@ nis_freeservlist (nis_server **serv)
i = 0;
while (serv[i] != NULL)
{
- nis_free_servers (serv[i], 1);
+ xdr_free ((xdrproc_t)xdr_nis_server, (char *)serv[i]);
free (serv[i]);
++i;
}
diff --git a/nis/nis_intern.h b/nis/nis_intern.h
index ce88f0790d..e714621f1b 100644
--- a/nis/nis_intern.h
+++ b/nis/nis_intern.h
@@ -67,10 +67,6 @@ extern nis_error __do_niscall __P ((const_nis_name name, u_long prog,
extern AUTH *authdes_pk_create __P ((const char *, const netobj *, u_int,
struct sockaddr *, des_block *));
-/* NIS+ cache */
-extern directory_obj *__cache_search __P ((const_nis_name name));
-extern nis_error __cache_add __P ((fd_result *));
-
/* NIS+ callback */
extern nis_error __nis_do_callback __P ((struct dir_binding *bptr,
netobj *cookie, struct nis_cb *cb));
diff --git a/nis/nis_ismember.c b/nis/nis_ismember.c
index 85c401531e..aadd19753a 100644
--- a/nis/nis_ismember.c
+++ b/nis/nis_ismember.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
/* internal_nis_ismember ()
return codes: -1 principal is in -group
@@ -28,105 +27,97 @@
static int
internal_ismember (const_nis_name principal, const_nis_name group)
{
- if (group != NULL && strlen (group) > 0)
- {
- char buf[strlen (group) + 50];
- char leafbuf[strlen (group) + 2];
- char domainbuf[strlen (group) + 2];
- nis_result *res;
- char *cp, *cp2;
- u_int i;
+ char buf[strlen (group) + 50];
+ char leafbuf[strlen (group) + 2];
+ char domainbuf[strlen (group) + 2];
+ nis_result *res;
+ char *cp, *cp2;
+ u_int i;
- cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
- cp = stpcpy (cp, ".groups_dir");
- cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
- if (cp2 != NULL && strlen (cp2) > 0)
- {
- *cp++ = '.';
- strcpy (cp, cp2);
- }
- res = nis_lookup (buf, EXPAND_NAME|FOLLOW_LINKS);
- if (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)
- return 0;
+ cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
+ cp = stpcpy (cp, ".groups_dir");
+ cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
+ if (cp2 != NULL && strlen (cp2) > 0)
+ {
+ *cp++ = '.';
+ strcpy (cp, cp2);
+ }
+ res = nis_lookup (buf, EXPAND_NAME|FOLLOW_LINKS);
+ if (NIS_RES_STATUS (res) != NIS_SUCCESS)
+ return 0;
- if ((res->objects.objects_len != 1) ||
- (res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
- return 0;
+ if ((NIS_RES_NUMOBJ (res) != 1) ||
+ (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
+ return 0;
- /* We search twice in the list, at first, if we have the name
- with a "-", then if without. "-member" has priority */
- for (i = 0;
- i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
- ++i)
+ /* We search twice in the list, at first, if we have the name
+ with a "-", then if without. "-member" has priority */
+ for (i = 0; i < NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len; ++i)
+ {
+ cp = NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[i];
+ if (cp[0] == '-')
{
- cp =res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i];
- if (cp[0] == '-')
- {
- if (strcmp (&cp[1], principal) == 0)
+ if (strcmp (&cp[1], principal) == 0)
+ return -1;
+ if (cp[1] == '@')
+ switch (internal_ismember (principal, &cp[2]))
+ {
+ case -1:
return -1;
- if (cp[1] == '@')
- switch (internal_ismember (principal, &cp[2]))
- {
- case -1:
- return -1;
- case 1:
- return -1;
- default:
- break;
- }
- else
- if (cp[1] == '*')
- {
- char buf1[strlen (principal) + 2];
- char buf2[strlen (cp) + 2];
+ case 1:
+ return -1;
+ default:
+ break;
+ }
+ else
+ if (cp[1] == '*')
+ {
+ char buf1[strlen (principal) + 2];
+ char buf2[strlen (cp) + 2];
- strcpy (buf1, nis_domain_of (principal));
- strcpy (buf2, nis_domain_of (cp));
- if (strcmp (buf1, buf2) == 0)
- return -1;
- }
- }
+ strcpy (buf1, nis_domain_of (principal));
+ strcpy (buf2, nis_domain_of (cp));
+ if (strcmp (buf1, buf2) == 0)
+ return -1;
+ }
}
- for (i = 0;
- i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
- ++i)
+ }
+ for (i = 0; i < NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len; ++i)
+ {
+ cp = NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[i];
+ if (cp[0] != '-')
{
- cp =res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i];
- if (cp[0] != '-')
- {
- if (strcmp (cp, principal) == 0)
+ if (strcmp (cp, principal) == 0)
+ return 1;
+ if (cp[0] == '@')
+ switch (internal_ismember (principal, &cp[1]))
+ {
+ case -1:
+ return -1;
+ case 1:
return 1;
- if (cp[0] == '@')
- switch (internal_ismember (principal, &cp[1]))
- {
- case -1:
- return -1;
- case 1:
- return 1;
- default:
- break;
- }
- else
- if (cp[0] == '*')
- {
- char buf1[strlen (principal) + 2];
- char buf2[strlen (cp) + 2];
+ default:
+ break;
+ }
+ else
+ if (cp[0] == '*')
+ {
+ char buf1[strlen (principal) + 2];
+ char buf2[strlen (cp) + 2];
- if (strcmp (nis_domain_of_r (principal, buf1, sizeof buf1),
- nis_domain_of_r (cp, buf2, sizeof buf2)) == 0)
- return 1;
- }
- }
+ if (strcmp (nis_domain_of_r (principal, buf1, sizeof buf1),
+ nis_domain_of_r (cp, buf2, sizeof buf2)) == 0)
+ return 1;
+ }
}
}
-
return 0;
}
bool_t
nis_ismember (const_nis_name principal, const_nis_name group)
{
- if (group != NULL && strlen (group) > 0)
+ if (group != NULL && strlen (group) > 0 && principal != NULL)
return internal_ismember (principal, group) == 1 ? TRUE : FALSE;
else
return FALSE;
diff --git a/nis/nis_local_names.c b/nis/nis_local_names.c
index 348c7534a3..bcae995837 100644
--- a/nis/nis_local_names.c
+++ b/nis/nis_local_names.c
@@ -21,7 +21,6 @@
#include <string.h>
#include <unistd.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_name
nis_local_group (void)
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index bdce5d5a0a..cbc64c34a4 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
@@ -72,7 +71,7 @@ nis_lookup (const_nis_name name, const u_long flags)
case NIS_PARTIAL:
case NIS_SUCCESS:
case NIS_S_SUCCESS:
- if (__type_of(NIS_RES_OBJECT (res)) == LINK_OBJ &&
+ if (__type_of(NIS_RES_OBJECT (res)) == NIS_LINK_OBJ &&
flags & FOLLOW_LINKS) /* We are following links */
{
/* if we hit the link limit, bail */
@@ -93,7 +92,7 @@ nis_lookup (const_nis_name name, const u_long flags)
++done;
break;
case NIS_CBRESULTS:
- /* XXX Implement CALLBACK here ! */
+ /* The callback is handled in __do_niscall2 */
++done;
break;
case NIS_UNAVAIL:
diff --git a/nis/nis_mkdir.c b/nis/nis_mkdir.c
index ab693d7da1..acd0122bdf 100644
--- a/nis/nis_mkdir.c
+++ b/nis/nis_mkdir.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_error
diff --git a/nis/nis_modify.c b/nis/nis_modify.c
index 739ae0c351..3f2cca4698 100644
--- a/nis/nis_modify.c
+++ b/nis/nis_modify.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
@@ -60,7 +59,7 @@ nis_modify (const_nis_name name, const nis_object *obj)
(caddr_t) & req, (xdrproc_t) xdr_nis_result,
(caddr_t) res, MASTER_ONLY,
NULL)) != RPC_SUCCESS)
- res->status = status;
+ NIS_RES_STATUS (res) = status;
req.ns_object.ns_object_val[0].zo_name = p1;
req.ns_object.ns_object_val[0].zo_owner = p2;
diff --git a/nis/nis_ping.c b/nis/nis_ping.c
index a06dfdee8d..1397cb9c98 100644
--- a/nis/nis_ping.c
+++ b/nis/nis_ping.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
void
@@ -35,7 +34,7 @@ nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj)
if (dirobj == NULL)
{
res = nis_lookup (dirname, MASTER_ONLY);
- if (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)
+ if (res->status != NIS_SUCCESS)
return;
obj = res->objects.objects_val;
}
@@ -43,7 +42,7 @@ nis_ping (const_nis_name dirname, u_long utime, const nis_object *dirobj)
obj = (nis_object *) dirobj;
/* Check if obj is really a diryectory object */
- if (obj->zo_data.zo_type != DIRECTORY_OBJ)
+ if (__type_of (obj) != NIS_DIRECTORY_OBJ)
{
if (res != NULL)
nis_freeresult (res);
diff --git a/nis/nis_print.c b/nis/nis_print.c
index 1914840e86..5aa43c340f 100644
--- a/nis/nis_print.c
+++ b/nis/nis_print.c
@@ -21,7 +21,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
static const char *
nis_nstype2str (const nstype type)
@@ -49,10 +48,9 @@ nis_nstype2str (const nstype type)
}
}
-static char *
-nis_ttl2str (const u_long ttl)
+static void
+print_ttl (const u_long ttl)
{
- static char buf[64];
unsigned long int time, s, m, h;
time = ttl;
@@ -62,19 +60,40 @@ nis_ttl2str (const u_long ttl)
m = time / 60;
time %= 60;
s = time;
- snprintf (buf, 63, "%lu:%02lu:%02lu", h, m, s);
-
- return buf;
+ printf ("%lu:%lu:%lu\n", h, m, s);
}
-static char *
-nis_flags2str (const u_long flags)
+static void
+print_flags (const u_long flags)
{
- static char buf[1024];
+ fputs ("(", stdout);
- snprintf (buf, 1023, "%lu", flags);
+ if (flags & TA_SEARCHABLE)
+ fputs ("SEARCHABLE, ", stdout);
- return buf;
+ if (flags & TA_BINARY)
+ {
+ fputs ("BINARY DATA", stdout);
+ if (flags & TA_XDR)
+ fputs (", XDR ENCODED", stdout);
+ if (flags & TA_ASN1)
+ fputs (", ASN.1 ENCODED", stdout);
+ if (flags & TA_CRYPT)
+ fputs (", ENCRYPTED", stdout);
+ }
+ else
+ {
+ fputs("TEXTUAL DATA", stdout);
+ if (flags & TA_SEARCHABLE)
+ {
+ if (flags & TA_CASE)
+ fputs (", CASE INSENSITIVE", stdout);
+ else
+ fputs (", CASE SENSITIVE", stdout);
+ }
+ }
+
+ fputs (")\n", stdout);
}
static void
@@ -82,28 +101,28 @@ nis_print_objtype (enum zotypes type)
{
switch (type)
{
- case BOGUS_OBJ:
+ case NIS_BOGUS_OBJ:
fputs (_("BOGUS OBJECT\n"), stdout);
break;
- case NO_OBJ:
+ case NIS_NO_OBJ:
fputs (_("NO OBJECT\n"), stdout);
break;
- case DIRECTORY_OBJ:
+ case NIS_DIRECTORY_OBJ:
fputs (_("DIRECTORY\n"), stdout);
break;
- case GROUP_OBJ:
+ case NIS_GROUP_OBJ:
fputs (_("GROUP\n"), stdout);
break;
- case TABLE_OBJ:
+ case NIS_TABLE_OBJ:
fputs (_("TABLE\n"), stdout);
break;
- case ENTRY_OBJ:
+ case NIS_ENTRY_OBJ:
fputs (_("ENTRY\n"), stdout);
break;
- case LINK_OBJ:
+ case NIS_LINK_OBJ:
fputs (_("LINK\n"), stdout);
break;
- case PRIVATE_OBJ:
+ case NIS_PRIVATE_OBJ:
fputs (_("PRIVATE\n"), stdout);
break;
default:
@@ -141,7 +160,7 @@ nis_print_directory (const directory_obj *dir)
unsigned int i;
printf (_("Name : '%s'\n"), dir->do_name);
- printf (_("Type : %s\n"), gettext (nis_nstype2str (dir->do_type)));
+ printf (_("Type : %s\n"), nis_nstype2str (dir->do_type));
sptr = dir->do_servers.do_servers_val;
for (i = 0; i < dir->do_servers.do_servers_len; i++)
{
@@ -157,16 +176,20 @@ nis_print_directory (const directory_obj *dir)
fputs (_("None.\n"), stdout);
break;
case NIS_PK_DH:
- fputs (_("DH.\n"), stdout);
+ fprintf (stdout, _("Diffie-Hellmann (%d bits)\n"),
+ (sptr->pkey.n_len - 1) * 4);
+ /* sptr->pkey.n_len counts the last 0, too */
break;
case NIS_PK_RSA:
- fputs (_("RSA.\n"), stdout);
+ fprintf (stdout, _("RSA (%d bits)\n"),
+ (sptr->pkey.n_len - 1) * 4);
break;
case NIS_PK_KERB:
- fputs (_("Kerberous.\n"), stdout);
+ fputs (_("Kerberos.\n"), stdout);
break;
default:
- fputs (_("Unknown.\n"), stdout);
+ fprintf (stdout, _("Unknown (type = %d, bits = %d)\n"),
+ sptr->key_type, (sptr->pkey.n_len - 1) * 4);
break;
}
@@ -198,7 +221,9 @@ nis_print_directory (const directory_obj *dir)
sptr++;
}
- printf (_("Time to live : %s\n"), nis_ttl2str (dir->do_ttl));
+ fputs (_("Time to live : "), stdout);
+ print_ttl (dir->do_ttl);
+ fputs (_("Default Access rights :\n"), stdout);
if (dir->do_armask.do_armask_len != 0)
{
oar_mask *ptr;
@@ -206,9 +231,11 @@ nis_print_directory (const directory_obj *dir)
ptr = dir->do_armask.do_armask_val;
for (i = 0; i < dir->do_armask.do_armask_len; i++)
{
- fputs (_("Default Access rights: "), stdout);
nis_print_rights (ptr->oa_rights);
- printf (_("\nDirect Type : %d\n"), ptr->oa_otype);
+ printf (_("\tType : %s\n"), nis_nstype2str (ptr->oa_otype));
+ printf (_("\tAccess rights: "));
+ nis_print_rights (ptr->oa_rights);
+ fputs ("\n", stdout);
ptr++;
}
}
@@ -242,8 +269,8 @@ nis_print_table (const table_obj *obj)
{
printf (_("\t[%d]\tName : %s\n"), i,
obj->ta_cols.ta_cols_val[i].tc_name);
- printf (_("\t\tAttributes : %s\n"),
- nis_flags2str (obj->ta_cols.ta_cols_val[i].tc_flags));
+ fputs (_("\t\tAttributes : "), stdout);
+ print_flags (obj->ta_cols.ta_cols_val[i].tc_flags);
fputs (_("\t\tAccess Rights : "), stdout);
nis_print_rights (obj->ta_cols.ta_cols_val[i].tc_rights);
fputc ('\n', stdout);
@@ -274,7 +301,8 @@ nis_print_entry (const entry_obj *obj)
else if ((obj->en_cols.en_cols_val[i].ec_flags & EN_BINARY) == EN_BINARY)
fputs (_("Binary data\n"), stdout);
else
- printf ("%s\n", obj->en_cols.en_cols_val[i].ec_value.ec_value_val);
+ printf ("%.*s\n", (int)obj->en_cols.en_cols_val[i].ec_value.ec_value_len,
+ obj->en_cols.en_cols_val[i].ec_value.ec_value_val);
}
}
@@ -287,29 +315,30 @@ nis_print_object (const nis_object * obj)
printf (_("Group : %s\n"), obj->zo_group);
fputs (_("Access Rights : "), stdout);
nis_print_rights (obj->zo_access);
- printf (_("\nTime to Live : %lu (seconds)\n"), obj->zo_ttl);
+ printf (_("\nTime to Live : "));
+ print_ttl (obj->zo_ttl);
printf (_("Creation Time : %s"), ctime (&obj->zo_oid.ctime));
printf (_("Mod. Time : %s"), ctime (&obj->zo_oid.mtime));
fputs (_("Object Type : "), stdout);
nis_print_objtype (obj->zo_data.zo_type);
switch (obj->zo_data.zo_type)
{
- case DIRECTORY_OBJ:
+ case NIS_DIRECTORY_OBJ:
nis_print_directory (&obj->zo_data.objdata_u.di_data);
break;
- case GROUP_OBJ:
+ case NIS_GROUP_OBJ:
nis_print_group (&obj->zo_data.objdata_u.gr_data);
break;
- case TABLE_OBJ:
+ case NIS_TABLE_OBJ:
nis_print_table (&obj->zo_data.objdata_u.ta_data);
break;
- case ENTRY_OBJ:
+ case NIS_ENTRY_OBJ:
nis_print_entry (&obj->zo_data.objdata_u.en_data);
break;
- case LINK_OBJ:
+ case NIS_LINK_OBJ:
nis_print_link (&obj->zo_data.objdata_u.li_data);
break;
- case PRIVATE_OBJ:
+ case NIS_PRIVATE_OBJ:
printf (_(" Data Length = %u\n"),
obj->zo_data.objdata_u.po_data.po_data_len);
break;
diff --git a/nis/nis_print_group_entry.c b/nis/nis_print_group_entry.c
index 1063ef8411..fbc9ad11ba 100644
--- a/nis/nis_print_group_entry.c
+++ b/nis/nis_print_group_entry.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
void
nis_print_group_entry (const_nis_name group)
@@ -29,6 +28,10 @@ nis_print_group_entry (const_nis_name group)
char buf[strlen (group) + 50];
char leafbuf[strlen (group) + 3];
char domainbuf[strlen (group) + 3];
+ 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;
+ char **mem_exp, **mem_imp, **mem_rec;
+ char **nomem_exp, **nomem_imp, **nomem_rec;
nis_result *res;
char *cp, *cp2;
u_int i;
@@ -41,19 +44,132 @@ nis_print_group_entry (const_nis_name group)
*cp++ = '.';
stpcpy (cp, cp2);
}
- res = nis_lookup (buf, FOLLOW_LINKS|EXPAND_NAME);
+ res = nis_lookup (buf, FOLLOW_LINKS | EXPAND_NAME);
- if (res->status != NIS_SUCCESS && res->status != NIS_S_SUCCESS)
+ if (NIS_RES_STATUS(res) != NIS_SUCCESS)
return;
- if ((res->objects.objects_len != 1) ||
- (res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
+ if ((NIS_RES_NUMOBJ (res) != 1) ||
+ (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
return;
+ mem_exp = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ mem_imp = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ mem_rec = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ nomem_exp = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ nomem_imp = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+ nomem_rec = malloc (sizeof (char *) * NIS_RES_NUMOBJ (res));
+
for (i = 0;
- i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
- ++i)
- fprintf (stdout, " %s\n",
- res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i]);
+ i < NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len; ++i)
+ {
+ char *grmem =
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val[i];
+ int neg = grmem[0] == '-';
+
+ switch (grmem[neg])
+ {
+ case '*':
+ if (neg)
+ {
+ nomem_imp[nomem_imp_cnt] = grmem;
+ ++nomem_imp_cnt;
+ }
+ else
+ {
+ mem_imp[mem_imp_cnt] = grmem;
+ ++mem_imp_cnt;
+ }
+ break;
+ case '@':
+ if (neg)
+ {
+ nomem_rec[nomem_rec_cnt] = grmem;
+ ++nomem_rec_cnt;
+ }
+ else
+ {
+ mem_rec[mem_rec_cnt] = grmem;
+ ++mem_rec_cnt;
+ }
+ break;
+ default:
+ if (neg)
+ {
+ nomem_exp[nomem_exp_cnt] = grmem;
+ ++nomem_exp_cnt;
+ }
+ else
+ {
+ mem_exp[mem_exp_cnt] = grmem;
+ ++mem_exp_cnt;
+ }
+ break;
+ }
+ }
+ {
+ char buf[strlen (NIS_RES_OBJECT (res)->zo_domain) + 10];
+ printf (_("Group entry for \"%s.%s\" group:\n"),
+ NIS_RES_OBJECT (res)->zo_name,
+ nis_domain_of_r (NIS_RES_OBJECT (res)->zo_domain,
+ buf, strlen (NIS_RES_OBJECT (res)->zo_domain)
+ + 10));
+ }
+ if (mem_exp_cnt)
+ {
+ fputs (_(" Explicit members:\n"), stdout);
+ for (i = 0; i < mem_exp_cnt; ++i)
+ printf ("\t%s\n", mem_exp[i]);
+ }
+ else
+ fputs (_(" No explicit members\n"), stdout);
+ if (mem_imp_cnt)
+ {
+ fputs (_(" Implicit members:\n"), stdout);
+ for (i = 0; i < mem_imp_cnt; ++i)
+ printf ("\t%s\n", &mem_imp[i][2]);
+ }
+ else
+ fputs (_(" No implicit members\n"), stdout);
+ if (mem_rec_cnt)
+ {
+ fputs (_(" Recursive members:\n"), stdout);
+ for (i = 0; i < mem_rec_cnt; ++i)
+ printf ("\t%s\n", &mem_rec[i][1]);
+ }
+ else
+ fputs (_(" No recursive members\n"), stdout);
+ if (nomem_exp_cnt)
+ {
+ fputs (_(" Explicit nonmembers:\n"), stdout);
+ for (i = 0; i < nomem_exp_cnt; ++i)
+ printf ("\t%s\n", &nomem_exp[i][1]);
+ }
+ else
+ fputs (_(" No explicit nonmembers\n"), stdout);
+ if (nomem_imp_cnt)
+ {
+ fputs (_(" Implicit nonmembers:\n"), stdout);
+ for (i = 0; i < nomem_imp_cnt; ++i)
+ printf ("\t%s\n", &mem_imp[i][3]);
+ }
+ else
+ fputs (_(" No implicit nonmembers\n"), stdout);
+ if (nomem_rec_cnt)
+ {
+ fputs (_(" Explicit nonmembers:\n"), stdout);
+ for (i = 0; i < nomem_rec_cnt; ++i)
+ printf ("\t%s=n", &nomem_rec[i][2]);
+ }
+ else
+ fputs (_(" No recursive nonmembers\n"), stdout);
+
+ free (mem_exp);
+ free (mem_imp);
+ free (mem_rec);
+ free (nomem_exp);
+ free (nomem_imp);
+ free (nomem_rec);
+ nis_freeresult (res);
}
}
diff --git a/nis/nis_remove.c b/nis/nis_remove.c
index 2fa9ecc353..cbbbdfcfd0 100644
--- a/nis/nis_remove.c
+++ b/nis/nis_remove.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
@@ -48,7 +47,7 @@ nis_remove (const_nis_name name, const nis_object *obj)
(caddr_t) & req, (xdrproc_t) xdr_nis_result,
(caddr_t) res, MASTER_ONLY,
NULL)) != RPC_SUCCESS)
- res->status = status;
+ NIS_RES_STATUS (res) = status;
nis_destroy_object (req.ns_object.ns_object_val);
diff --git a/nis/nis_removemember.c b/nis/nis_removemember.c
index 8ed67caf98..71807a3ffe 100644
--- a/nis/nis_removemember.c
+++ b/nis/nis_removemember.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_removemember (const_nis_name member, const_nis_name group)
@@ -50,40 +49,40 @@ nis_removemember (const_nis_name member, const_nis_name group)
nis_freeresult (res);
return status;
}
+
if ((res->objects.objects_len != 1) ||
- (res->objects.objects_val[0].zo_data.zo_type != GROUP_OBJ))
+ (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
return NIS_INVALIDOBJ;
-
- newmem = calloc (1, res->objects.objects_val[0].GR_data.gr_members.gr_members_len *
- sizeof (char *));
-
- k = res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
+ newmem =
+ calloc (1, NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len *
+ sizeof (char *));
+ k = NIS_RES_OBJECT (res)[0].GR_data.gr_members.gr_members_len;
j = 0;
- for (i = 0; i < res->objects.objects_val[0].GR_data.gr_members.gr_members_len;
+ for (i = 0; i < NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_len;
++i)
{
- if (strcmp (res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i],
+ if (strcmp (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val[i],
member) != 0)
{
- newmem[j] = res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i];
+ newmem[j] = NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val[i];
++j;
}
else
{
- free (res->objects.objects_val[0].GR_data.gr_members.gr_members_val[i]);
+ free (NIS_RES_OBJECT(res)->GR_data.gr_members.gr_members_val[i]);
--k;
}
}
- free (res->objects.objects_val[0].GR_data.gr_members.gr_members_val);
+ free (NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val);
newmem = realloc (newmem, k * sizeof (char*));
- res->objects.objects_val[0].GR_data.gr_members.gr_members_val = newmem;
- res->objects.objects_val[0].GR_data.gr_members.gr_members_len = k;
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_val = newmem;
+ NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len = k;
- cp = stpcpy (buf, res->objects.objects_val->zo_name);
+ cp = stpcpy (buf, NIS_RES_OBJECT (res)->zo_name);
*cp++ = '.';
- strncpy (cp, res->objects.objects_val->zo_domain, NIS_MAXNAMELEN);
- res2 = nis_modify (buf, res->objects.objects_val);
+ strncpy (cp, NIS_RES_OBJECT (res)->zo_domain, NIS_MAXNAMELEN);
+ res2 = nis_modify (buf, NIS_RES_OBJECT (res));
status = res2->status;
nis_freeresult (res);
nis_freeresult (res2);
diff --git a/nis/nis_rmdir.c b/nis/nis_rmdir.c
index ff84ed81e2..f1214f9f80 100644
--- a/nis/nis_rmdir.c
+++ b/nis/nis_rmdir.c
@@ -18,7 +18,6 @@
Boston, MA 02111-1307, USA. */
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
nis_error
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index fcd1903638..3283e4cf93 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -20,7 +20,6 @@
#include <errno.h>
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_name
nis_leaf_of (const_nis_name name)
diff --git a/nis/nis_table.c b/nis/nis_table.c
index 3efba6084e..d2a1df76b2 100644
--- a/nis/nis_table.c
+++ b/nis/nis_table.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
#include "nis_intern.h"
static void
@@ -146,9 +145,7 @@ __create_ib_request (const_nis_name name, struct ib_request *ibreq,
if (ibreq->ibr_name == NULL)
return NULL;
- ibreq->ibr_flags = (flags & (RETURN_RESULT | ADD_OVERWRITE | REM_MULTIPLE |
- MOD_SAMEOBJ | ADD_RESERVED | REM_RESERVED |
- MOD_EXCLUSIVE | ALL_RESULTS));
+ ibreq->ibr_flags = flags;
ibreq->ibr_obj.ibr_obj_len = 0;
ibreq->ibr_obj.ibr_obj_val = NULL;
ibreq->ibr_cbhost.ibr_cbhost_len = 0;
@@ -168,7 +165,7 @@ nis_list (const_nis_name name, u_long flags,
const void *userdata)
{
nis_result *res = NULL;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
int status;
int count_links = 0; /* We will only follow NIS_MAXLINKS links! */
int done = 0;
@@ -179,7 +176,7 @@ nis_list (const_nis_name name, u_long flags,
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, flags) == NULL)
+ if (__create_ib_request (name, ibreq, flags) == NULL)
{
res->status = NIS_BADNAME;
return res;
@@ -187,20 +184,20 @@ nis_list (const_nis_name name, u_long flags,
if (flags & EXPAND_NAME)
{
- names = nis_getnames (ibreq.ibr_name);
- free (ibreq.ibr_name);
- ibreq.ibr_name = NULL;
+ names = nis_getnames (ibreq->ibr_name);
+ free (ibreq->ibr_name);
+ ibreq->ibr_name = NULL;
if (names == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- ibreq.ibr_name = strdup (names[name_nr]);
+ ibreq->ibr_name = strdup (names[name_nr]);
}
else
{
names = namebuf;
- names[name_nr] = ibreq.ibr_name;
+ names[name_nr] = ibreq->ibr_name;
}
cb = NULL;
@@ -228,7 +225,7 @@ nis_list (const_nis_name name, u_long flags,
/* nis_lookup handles FOLLOW_LINKS,
so we must have a table object. */
- if (__type_of (NIS_RES_OBJECT (lres)) != TABLE_OBJ)
+ if (__type_of (NIS_RES_OBJECT (lres)) != NIS_TABLE_OBJ)
{
nis_freeresult (lres);
res->status = NIS_INVALIDOBJ;
@@ -276,17 +273,17 @@ nis_list (const_nis_name name, u_long flags,
if (callback != NULL)
{
cb = __nis_create_callback (callback, userdata, flags);
- ibreq.ibr_cbhost.ibr_cbhost_len = 1;
- ibreq.ibr_cbhost.ibr_cbhost_val = cb->serv;
+ ibreq->ibr_cbhost.ibr_cbhost_len = 1;
+ ibreq->ibr_cbhost.ibr_cbhost_val = cb->serv;
}
while (!done)
{
memset (res, '\0', sizeof (nis_result));
- status = __do_niscall (ibreq.ibr_name, NIS_IBLIST,
+ status = __do_niscall (ibreq->ibr_name, NIS_IBLIST,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, flags, cb);
if (status != NIS_SUCCESS)
res->status = status;
@@ -296,7 +293,7 @@ nis_list (const_nis_name name, u_long flags,
case NIS_PARTIAL:
case NIS_SUCCESS:
case NIS_S_SUCCESS:
- if (__type_of (NIS_RES_OBJECT (res)) == LINK_OBJ &&
+ if (__type_of (NIS_RES_OBJECT (res)) == NIS_LINK_OBJ &&
flags & FOLLOW_LINKS) /* We are following links. */
{
/* If we hit the link limit, bail. */
@@ -307,17 +304,17 @@ nis_list (const_nis_name name, u_long flags,
break;
}
if (count_links)
- free (ibreq.ibr_name);
+ free (ibreq->ibr_name);
++count_links;
- free (ibreq.ibr_name);
- ibreq.ibr_name =
+ free (ibreq->ibr_name);
+ ibreq->ibr_name =
strdup (NIS_RES_OBJECT (res)->LI_data.li_name);
if (NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_len)
- if (ibreq.ibr_srch.ibr_srch_len == 0)
+ if (ibreq->ibr_srch.ibr_srch_len == 0)
{
- ibreq.ibr_srch.ibr_srch_len =
+ ibreq->ibr_srch.ibr_srch_len =
NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_len;
- ibreq.ibr_srch.ibr_srch_val =
+ ibreq->ibr_srch.ibr_srch_val =
NIS_RES_OBJECT (res)->LI_data.li_attrs.li_attrs_val;
}
nis_freeresult (res);
@@ -338,7 +335,7 @@ nis_list (const_nis_name name, u_long flags,
/* Try the next domainname if we don't follow a link. */
if (count_links)
{
- free (ibreq.ibr_name);
+ free (ibreq->ibr_name);
res->status = NIS_LINKNAMEERROR;
++done;
break;
@@ -349,7 +346,7 @@ nis_list (const_nis_name name, u_long flags,
++done;
break;
}
- ibreq.ibr_name = names[name_nr];
+ ibreq->ibr_name = names[name_nr];
break;
}
}
@@ -358,10 +355,14 @@ nis_list (const_nis_name name, u_long flags,
if (names != namebuf)
nis_freenames (names);
- nis_free_request (&ibreq);
-
if (cb)
- __nis_destroy_callback (cb);
+ {
+ __nis_destroy_callback (cb);
+ ibreq->ibr_cbhost.ibr_cbhost_len = 0;
+ ibreq->ibr_cbhost.ibr_cbhost_val = NULL;
+ }
+
+ nis_free_request (ibreq);
return res;
}
@@ -372,53 +373,52 @@ nis_add_entry (const_nis_name name, const nis_object *obj,
{
nis_result *res;
nis_error status;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
char *p1, *p2, *p3, *p4;
char buf1[strlen (name) + 20];
char buf4[strlen (name) + 20];
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, flags) == NULL)
+ if (__create_ib_request (name, ibreq, flags) == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- ibreq.ibr_flags = flags;
- ibreq.ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
- ibreq.ibr_obj.ibr_obj_len = 1;
+ ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
+ ibreq->ibr_obj.ibr_obj_len = 1;
- p1 = ibreq.ibr_obj.ibr_obj_val->zo_name;
+ p1 = ibreq->ibr_obj.ibr_obj_val->zo_name;
if (p1 == NULL || strlen (p1) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_name =
+ ibreq->ibr_obj.ibr_obj_val->zo_name =
nis_leaf_of_r (name, buf1, sizeof (buf1));
- p2 = ibreq.ibr_obj.ibr_obj_val->zo_owner;
+ p2 = ibreq->ibr_obj.ibr_obj_val->zo_owner;
if (p2 == NULL || strlen (p2) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
+ ibreq->ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
- p3 = ibreq.ibr_obj.ibr_obj_val->zo_group;
+ p3 = ibreq->ibr_obj.ibr_obj_val->zo_group;
if (p3 == NULL || strlen (p3) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
+ ibreq->ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
- p4 = ibreq.ibr_obj.ibr_obj_val->zo_domain;
- ibreq.ibr_obj.ibr_obj_val->zo_domain =
+ p4 = ibreq->ibr_obj.ibr_obj_val->zo_domain;
+ ibreq->ibr_obj.ibr_obj_val->zo_domain =
nis_domain_of_r (name, buf4, sizeof (buf4));
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBADD,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBADD,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq,
+ (caddr_t) ibreq,
(xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- ibreq.ibr_obj.ibr_obj_val->zo_name = p1;
- ibreq.ibr_obj.ibr_obj_val->zo_owner = p2;
- ibreq.ibr_obj.ibr_obj_val->zo_group = p3;
- ibreq.ibr_obj.ibr_obj_val->zo_domain = p4;
+ ibreq->ibr_obj.ibr_obj_val->zo_name = p1;
+ ibreq->ibr_obj.ibr_obj_val->zo_owner = p2;
+ ibreq->ibr_obj.ibr_obj_val->zo_group = p3;
+ ibreq->ibr_obj.ibr_obj_val->zo_domain = p4;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
@@ -429,52 +429,51 @@ nis_modify_entry (const_nis_name name, const nis_object *obj,
{
nis_result *res;
nis_error status;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
char *p1, *p2, *p3, *p4;
char buf1[strlen (name) + 20];
char buf4[strlen (name) + 20];
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, flags) == NULL)
+ if (__create_ib_request (name, ibreq, flags) == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- ibreq.ibr_flags = flags;
- ibreq.ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
- ibreq.ibr_obj.ibr_obj_len = 1;
+ ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
+ ibreq->ibr_obj.ibr_obj_len = 1;
- p1 = ibreq.ibr_obj.ibr_obj_val->zo_name;
+ p1 = ibreq->ibr_obj.ibr_obj_val->zo_name;
if (p1 == NULL || strlen (p1) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_name =
+ ibreq->ibr_obj.ibr_obj_val->zo_name =
nis_leaf_of_r (name, buf1, sizeof (buf1));
- p2 = ibreq.ibr_obj.ibr_obj_val->zo_owner;
+ p2 = ibreq->ibr_obj.ibr_obj_val->zo_owner;
if (p2 == NULL || strlen (p2) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
+ ibreq->ibr_obj.ibr_obj_val->zo_owner = nis_local_principal ();
- p3 = ibreq.ibr_obj.ibr_obj_val->zo_group;
+ p3 = ibreq->ibr_obj.ibr_obj_val->zo_group;
if (p3 == NULL || strlen (p3) == 0)
- ibreq.ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
+ ibreq->ibr_obj.ibr_obj_val->zo_group = nis_local_group ();
- p4 = ibreq.ibr_obj.ibr_obj_val->zo_domain;
- ibreq.ibr_obj.ibr_obj_val->zo_domain =
+ p4 = ibreq->ibr_obj.ibr_obj_val->zo_domain;
+ ibreq->ibr_obj.ibr_obj_val->zo_domain =
nis_domain_of_r (name, buf4, sizeof (buf4));
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBMODIFY,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBMODIFY,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- ibreq.ibr_obj.ibr_obj_val->zo_name = p1;
- ibreq.ibr_obj.ibr_obj_val->zo_owner = p2;
- ibreq.ibr_obj.ibr_obj_val->zo_group = p3;
- ibreq.ibr_obj.ibr_obj_val->zo_domain = p4;
+ ibreq->ibr_obj.ibr_obj_val->zo_name = p1;
+ ibreq->ibr_obj.ibr_obj_val->zo_owner = p2;
+ ibreq->ibr_obj.ibr_obj_val->zo_group = p3;
+ ibreq->ibr_obj.ibr_obj_val->zo_domain = p4;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
@@ -484,31 +483,30 @@ nis_remove_entry (const_nis_name name, const nis_object *obj,
u_long flags)
{
nis_result *res;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
nis_error status;
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, flags) == NULL)
+ if (__create_ib_request (name, ibreq, flags) == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- ibreq.ibr_flags = flags;
if (obj != NULL)
{
- ibreq.ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
- ibreq.ibr_obj.ibr_obj_len = 1;
+ ibreq->ibr_obj.ibr_obj_val = nis_clone_object (obj, NULL);
+ ibreq->ibr_obj.ibr_obj_len = 1;
}
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBREMOVE,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBREMOVE,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
@@ -517,24 +515,24 @@ nis_result *
nis_first_entry (const_nis_name name)
{
nis_result *res;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
nis_error status;
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, 0) == NULL)
+ if (__create_ib_request (name, ibreq, 0) == NULL)
{
res->status = NIS_BADNAME;
return res;
}
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBFIRST,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBFIRST,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
@@ -543,12 +541,12 @@ nis_result *
nis_next_entry (const_nis_name name, const netobj *cookie)
{
nis_result *res;
- struct ib_request ibreq;
+ ib_request *ibreq = calloc (1, sizeof (ib_request));
nis_error status;
res = calloc (1, sizeof (nis_result));
- if (__create_ib_request (name, &ibreq, 0) == NULL)
+ if (__create_ib_request (name, ibreq, 0) == NULL)
{
res->status = NIS_BADNAME;
return res;
@@ -556,24 +554,24 @@ nis_next_entry (const_nis_name name, const netobj *cookie)
if (cookie != NULL)
{
- ibreq.ibr_cookie.n_bytes = malloc (cookie->n_len);
- if (ibreq.ibr_cookie.n_bytes == NULL)
+ ibreq->ibr_cookie.n_bytes = malloc (cookie->n_len);
+ if (ibreq->ibr_cookie.n_bytes == NULL)
{
res->status = NIS_NOMEMORY;
free (res);
return NULL;
}
- memcpy (ibreq.ibr_cookie.n_bytes, cookie->n_bytes, cookie->n_len);
- ibreq.ibr_cookie.n_len = cookie->n_len;
+ memcpy (ibreq->ibr_cookie.n_bytes, cookie->n_bytes, cookie->n_len);
+ ibreq->ibr_cookie.n_len = cookie->n_len;
}
- if ((status = __do_niscall (ibreq.ibr_name, NIS_IBNEXT,
+ if ((status = __do_niscall (ibreq->ibr_name, NIS_IBNEXT,
(xdrproc_t) xdr_ib_request,
- (caddr_t) & ibreq, (xdrproc_t) xdr_nis_result,
+ (caddr_t) ibreq, (xdrproc_t) xdr_nis_result,
(caddr_t) res, 0, NULL)) != NIS_SUCCESS)
res->status = status;
- nis_free_request (&ibreq);
+ nis_free_request (ibreq);
return res;
}
diff --git a/nis/nis_verifygroup.c b/nis/nis_verifygroup.c
index 6a8ab01bd7..be65120ae8 100644
--- a/nis/nis_verifygroup.c
+++ b/nis/nis_verifygroup.c
@@ -19,7 +19,6 @@
#include <string.h>
#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
nis_error
nis_verifygroup (const_nis_name group)
diff --git a/nis/nis_xdr.c b/nis/nis_xdr.c
index 82df04e449..0c253da127 100644
--- a/nis/nis_xdr.c
+++ b/nis/nis_xdr.c
@@ -198,34 +198,34 @@ xdr_objdata (XDR *xdrs, objdata *objp)
return FALSE;
switch (objp->zo_type)
{
- case DIRECTORY_OBJ:
+ case NIS_DIRECTORY_OBJ:
if (!xdr_directory_obj (xdrs, &objp->objdata_u.di_data))
return FALSE;
break;
- case GROUP_OBJ:
+ case NIS_GROUP_OBJ:
if (!xdr_group_obj (xdrs, &objp->objdata_u.gr_data))
return FALSE;
break;
- case TABLE_OBJ:
+ case NIS_TABLE_OBJ:
if (!xdr_table_obj (xdrs, &objp->objdata_u.ta_data))
return FALSE;
break;
- case ENTRY_OBJ:
+ case NIS_ENTRY_OBJ:
if (!xdr_entry_obj (xdrs, &objp->objdata_u.en_data))
return FALSE;
break;
- case LINK_OBJ:
+ case NIS_LINK_OBJ:
if (!xdr_link_obj (xdrs, &objp->objdata_u.li_data))
return FALSE;
break;
- case PRIVATE_OBJ:
+ case NIS_PRIVATE_OBJ:
if (!xdr_bytes (xdrs, (char **) &objp->objdata_u.po_data.po_data_val,
(u_int *) & objp->objdata_u.po_data.po_data_len, ~0))
return FALSE;
break;
- case NO_OBJ:
+ case NIS_NO_OBJ:
break;
- case BOGUS_OBJ:
+ case NIS_BOGUS_OBJ:
break;
default:
break;
diff --git a/nis/nss_nisplus/nisplus-alias.c b/nis/nss_nisplus/nisplus-alias.c
index f074c5fa63..76c6f25813 100644
--- a/nis/nss_nisplus/nisplus-alias.c
+++ b/nis/nss_nisplus/nisplus-alias.c
@@ -67,7 +67,7 @@ _nss_nisplus_parse_aliasent (nis_result *result, unsigned long entry,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (&result->objects.objects_val[entry]) != ENTRY_OBJ ||
+ __type_of (&result->objects.objects_val[entry]) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[entry].EN_data.en_type,
"mail_aliases") != 0 ||
result->objects.objects_val[entry].EN_data.en_cols.en_cols_len < 2)
diff --git a/nis/nss_nisplus/nisplus-ethers.c b/nis/nss_nisplus/nisplus-ethers.c
index b21c276df2..8ca6935cc7 100644
--- a/nis/nss_nisplus/nisplus-ethers.c
+++ b/nis/nss_nisplus/nisplus-ethers.c
@@ -63,7 +63,7 @@ _nss_nisplus_parse_etherent (nis_result *result, struct etherent *ether,
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
result->objects.objects_len != 1 ||
- __type_of (NIS_RES_OBJECT (result)) != ENTRY_OBJ ||
+ __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ ||
strcmp(NIS_RES_OBJECT (result)->EN_data.en_type,
"ethers_tbl") != 0 ||
NIS_RES_OBJECT(result)->EN_data.en_cols.en_cols_len < 2)
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index 7fefec0fd3..d1aa5ef787 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -57,7 +57,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[0].EN_data.en_type,
"hosts_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 4)
@@ -340,7 +340,7 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
/* If we do not find it, try it as original name. But if the
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val->EN_data.en_type,
"hosts_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 3)
diff --git a/nis/nss_nisplus/nisplus-network.c b/nis/nss_nisplus/nisplus-network.c
index 8aa8bc0f9e..e548017068 100644
--- a/nis/nss_nisplus/nisplus-network.c
+++ b/nis/nss_nisplus/nisplus-network.c
@@ -54,7 +54,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[0].EN_data.en_type,
"networks_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3)
@@ -310,7 +310,7 @@ _nss_nisplus_getnetbyname_r (const char *name, struct netent *network,
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS &&
result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[0].EN_data.en_type,
"networks_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3)
diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
index db5f487159..b700fa66b4 100644
--- a/nis/nss_nisplus/nisplus-parser.c
+++ b/nis/nss_nisplus/nisplus-parser.c
@@ -44,7 +44,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
result->objects.objects_len != 1 ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val->EN_data.en_type,
"passwd_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 7)
@@ -141,7 +141,7 @@ _nss_nisplus_parse_grent (nis_result *result, u_long entry,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of(result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of(result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val[entry].EN_data.en_type,
"group_tbl") != 0 ||
result->objects.objects_val[entry].EN_data.en_cols.en_cols_len < 4)
@@ -250,7 +250,7 @@ _nss_nisplus_parse_spent (nis_result *result, struct spwd *sp,
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
result->objects.objects_len != 1 ||
- __type_of(result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of(result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"passwd_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 8)
diff --git a/nis/nss_nisplus/nisplus-proto.c b/nis/nss_nisplus/nisplus-proto.c
index b64d4bdd02..2cbd9fe2fa 100644
--- a/nis/nss_nisplus/nisplus-proto.c
+++ b/nis/nss_nisplus/nisplus-proto.c
@@ -52,7 +52,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (NIS_RES_OBJECT (result)) != ENTRY_OBJ ||
+ __type_of (NIS_RES_OBJECT (result)) != NIS_ENTRY_OBJ ||
strcmp (NIS_RES_OBJECT (result)->EN_data.en_type, "protocols_tbl") != 0
|| NIS_RES_OBJECT (result)->EN_data.en_cols.en_cols_len < 3)
return 0;
@@ -282,7 +282,7 @@ _nss_nisplus_getprotobyname_r (const char *name, struct protoent *proto,
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS &&
result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"protocols_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 3)
diff --git a/nis/nss_nisplus/nisplus-rpc.c b/nis/nss_nisplus/nisplus-rpc.c
index e93a51652e..77a7248305 100644
--- a/nis/nss_nisplus/nisplus-rpc.c
+++ b/nis/nss_nisplus/nisplus-rpc.c
@@ -53,7 +53,7 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp(result->objects.objects_val[0].EN_data.en_type,
"rpc_tbl") != 0 ||
result->objects.objects_val[0].EN_data.en_cols.en_cols_len < 3)
@@ -282,7 +282,7 @@ _nss_nisplus_getrpcbyname_r (const char *name, struct rpcent *rpc,
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS &&
result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"rpc_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 3)
diff --git a/nis/nss_nisplus/nisplus-service.c b/nis/nss_nisplus/nisplus-service.c
index e1a89f92be..95a8cfa74b 100644
--- a/nis/nss_nisplus/nisplus-service.c
+++ b/nis/nss_nisplus/nisplus-service.c
@@ -52,7 +52,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
return 0;
if ((result->status != NIS_SUCCESS && result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"services_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 4)
@@ -294,7 +294,7 @@ _nss_nisplus_getservbyname_r (const char *name, const char *protocol,
database is correct, we should find it in the first case, too */
if ((result->status != NIS_SUCCESS &&
result->status != NIS_S_SUCCESS) ||
- __type_of (result->objects.objects_val) != ENTRY_OBJ ||
+ __type_of (result->objects.objects_val) != NIS_ENTRY_OBJ ||
strcmp (result->objects.objects_val->EN_data.en_type,
"services_tbl") != 0 ||
result->objects.objects_val->EN_data.en_cols.en_cols_len < 4)
diff --git a/nis/rpcsvc/nis.h b/nis/rpcsvc/nis.h
index f94b96cba4..c0d25325c1 100644
--- a/nis/rpcsvc/nis.h
+++ b/nis/rpcsvc/nis.h
@@ -46,14 +46,15 @@ __BEGIN_DECLS
* which defines the tag values. This allows the tags to change without
* having to change the nis.x file.
*
- * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when
- * rpcgen is run on the nis.x file. Note that there is a
- * simple sed script to remove some unneeded lines. (See the
- * Makefile target nis.h)
+ * NOTE : THIS FILE IS NOT GENERATED WITH RPCGEN ! SO YOU HAVE TO
+ * ADD ALL THE CHANGES ON nis_*.x FILES HERE AGAIN !
*
+ * I have removed all the Solaris internal structs and variables,
+ * because they are not supported, Sun changed them between various
+ * releases and they shouldn't be used in user programs.
+ * <kukuk@vt.uni-paderborn.de>
*/
-#pragma ident "@(#)nis_object.x 1.7 92/07/14 SMI"
#ifndef __nis_object_h
#define __nis_object_h
@@ -94,6 +95,14 @@ enum zotypes {
ENTRY_OBJ = 5,
LINK_OBJ = 6,
PRIVATE_OBJ = 7,
+ NIS_BOGUS_OBJ = 0,
+ NIS_NO_OBJ = 1,
+ NIS_DIRECTORY_OBJ = 2,
+ NIS_GROUP_OBJ = 3,
+ NIS_TABLE_OBJ = 4,
+ NIS_ENTRY_OBJ = 5,
+ NIS_LINK_OBJ = 6,
+ NIS_PRIVATE_OBJ = 7
};
typedef enum zotypes zotypes;
extern bool_t xdr_zotypes __P ((XDR *, zotypes*));
@@ -472,30 +481,6 @@ struct fd_result {
typedef struct fd_result fd_result;
extern bool_t xdr_fd_result __P ((XDR *, fd_result*));
-/*
- * Generic "hash" datastructures, used by all types of hashed data.
- */
-struct nis_hash_data {
- nis_name name; /* NIS name of hashed item */
- int keychain; /* It's hash key (for pop) */
- struct nis_hash_data *next; /* Hash collision pointer */
- struct nis_hash_data *prv_item; /* A serial, doubly linked list */
- struct nis_hash_data *nxt_item; /* of items in the hash table */
-};
-typedef struct nis_hash_data NIS_HASH_ITEM;
-
-struct nis_hash_table {
- NIS_HASH_ITEM *keys[64]; /* A hash table of items */
- NIS_HASH_ITEM *first; /* The first "item" in serial list */
-};
-typedef struct nis_hash_table NIS_HASH_TABLE;
-
-/* Structure for storing dynamically allocated static data */
-struct nis_sdata {
- void *buf; /* Memory allocation pointer */
- u_long size; /* Buffer size */
-};
-
/* Generic client creating flags */
#define ZMH_VC 1
#define ZMH_DG 2
@@ -508,6 +493,15 @@ struct nis_sdata {
#define NIS_CREATE_ACC 4
#define NIS_DESTROY_ACC 8
/* Test macros. a == access rights, m == desired rights. */
+#define NIS_WORLD(a, m) (((a) & (m)) != 0)
+#define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0)
+#define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0)
+#define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0)
+/*
+ * EOL Alert - The following non-prefixed test macros are
+ * here for backward compatability, and will be not be present
+ * in future releases - use the NIS_*() macros above.
+ */
#define WORLD(a, m) (((a) & (m)) != 0)
#define GROUP(a, m) (((a) & ((m) << 8)) != 0)
#define OWNER(a, m) (((a) & ((m) << 16)) != 0)
diff --git a/nis/rpcsvc/nis.x b/nis/rpcsvc/nis.x
index 20a4733741..2d19f37931 100644
--- a/nis/rpcsvc/nis.x
+++ b/nis/rpcsvc/nis.x
@@ -28,13 +28,6 @@
% * Mountain View, California 94043
% */
-/*
- * From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems
- *
- * RPC Language Protocol description file for NIS Plus
- * This version : 1.61
- * Last Modified : 3/19/91
- */
#ifdef RPC_HDR
%/*
% * nis.h
@@ -44,9 +37,9 @@
% * structures used by the NIS service. It includes the file nis_tags.h
% * which defines the tag values. This allows the tags to change without
% * having to change the nis.x file.
-% *
+% *
% * NOTE : DO NOT EDIT THIS FILE! It is automatically generated when
-% * rpcgen is run on the nis.x file. Note that there is a
+% * rpcgen is run on the nis.x file. Note that there is a
% * simple sed script to remove some unneeded lines. (See the
% * Makefile target nis.h)
% *
@@ -75,7 +68,7 @@ enum nis_error {
NIS_NAMEUNREACHABLE = 5, /* Can't get there from here */
NIS_UNKNOWNOBJ = 6, /* Object type is bogus */
NIS_TRYAGAIN = 7, /* I'm busy, call back */
- NIS_SYSTEMERROR = 8, /* Out of band failure */
+ NIS_SYSTEMERROR = 8, /* Generic system error */
NIS_CHAINBROKEN = 9, /* First/Next warning */
NIS_PERMISSION = 10, /* Not enough permission to access */
NIS_NOTOWNER = 11, /* You don't own it, sorry */
@@ -118,11 +111,11 @@ enum nis_error {
};
-/*
+/*
* Structure definitions for the parameters and results of the actual
* NIS RPC calls.
*
- * This is the standard result (in the protocol) of most of the nis
+ * This is the standard result (in the protocol) of most of the nis
* requests.
*/
@@ -136,11 +129,11 @@ struct nis_result {
u_long cticks; /* Client ticks */
};
-/*
- * A Name Service request
- * This request is used to access the name space, ns_name is the name
+/*
+ * A Name Service request
+ * This request is used to access the name space, ns_name is the name
* of the object within the namespace and the object is it's value, for
- * add/modify, a copy of the original for remove.
+ * add/modify, a copy of the original for remove.
*/
struct ns_request {
@@ -148,7 +141,7 @@ struct ns_request {
nis_object ns_object<1>; /* Optional Object (add/remove) */
};
-/*
+/*
* An information base request
* This request includes the NIS name of the table we wish to search, the
* search criteria in the form of attribute/value pairs and an optional
@@ -168,7 +161,7 @@ struct ib_request {
};
/*
- * This argument to the PING call notifies the replicas that something in
+ * This argument to the PING call notifies the replicas that something in
* a directory has changed and this is it's timestamp. The replica will use
* the timestamp to determine if its resync operation was successful.
*/
@@ -177,8 +170,8 @@ struct ping_args {
u_long stamp; /* timestamp of the transaction */
};
-/*
- * These are the type of entries that are stored in the transaction log,
+/*
+ * These are the type of entries that are stored in the transaction log,
* note that modifications will appear as two entries, for names, they have
* a "OLD" entry followed by a "NEW" entry. For entries in tables, there
* is a remove followed by an add. It is done this way so that we can read
@@ -196,13 +189,13 @@ enum log_entry_t {
MOD_IBASE = 7, /* Entry was modified in information base */
UPD_STAMP = 8 /* Update timestamp (used as fenceposts) */
};
-
+
/*
- * This result is returned from the name service when it is requested to
+ * This result is returned from the name service when it is requested to
* dump logged entries from its transaction log. Information base updates
* will have the name of the information base in the le_name field and
* a canonical set of attribute/value pairs to fully specify the entry's
- * 'name'.
+ * 'name'.
*/
struct log_entry {
u_long le_time; /* Time in seconds */
@@ -218,7 +211,7 @@ struct log_result {
netobj lr_cookie; /* Used by the dump callback */
log_entry lr_entries<>; /* zero or more entries */
};
-
+
struct cp_result {
nis_error cp_status; /* Status of the checkpoint */
u_long cp_zticks; /* Service 'ticks' */
@@ -227,7 +220,7 @@ struct cp_result {
/*
* This structure defines a generic NIS tag list. The taglist contains
- * zero or tags, each of which is a type and a value. (u_long).
+ * zero or tags, each of which is a type and a value. (u_long).
* These are used to report statistics (see tag definitions below)
* and to set or reset state variables.
*/
@@ -254,17 +247,59 @@ struct fd_args {
struct fd_result {
nis_error status; /* Status returned by function */
nis_name source; /* Source of this answer */
- opaque dir_data<>; /* Directory Data (XDR'ed) */
+ opaque dir_data<>; /* Directory Data (XDR'ed) */
opaque signature<>; /* Signature of the source */
};
+%/*
+% * Structures used for server binding.
+% */
+struct nis_bound_endpoint {
+ endpoint ep;
+ int generation;
+ int rank;
+ u_long flags;
+ int hostnum;
+ int epnum;
+ nis_name uaddr;
+ endpoint cbep;
+};
+typedef struct nis_bound_endpoint nis_bound_endpoint;
+
+struct nis_bound_directory {
+ int generation;
+ int min_rank; /* minimum rank of bound endpoints */
+ int optimal_rank; /* best possible rank of all endpoints */
+ directory_obj dobj;
+ nis_bound_endpoint BEP<>;
+};
+typedef struct nis_bound_directory nis_bound_directory;
+%#define bep_len BEP.BEP_len
+%#define bep_val BEP.BEP_val
+
+struct nis_active_endpoint {
+ endpoint ep;
+ nis_name hostname;
+ int rank;
+ int uaddr_generation;
+ nis_name uaddr;
+ int cbep_generation;
+ endpoint cbep;
+};
+typedef struct nis_active_endpoint nis_active_endpoint;
+
+%/* defines for nis_bound_endpoint.flags */
+%#define NIS_BOUND 0x1
+%#define NIS_TRANSIENT_ERRORS 0x2
+
-/*
+
+/*
* What's going on here? Well, it's like this. When the service
* is being compiled it wants to have the service definition specific
* info included, and when the client is being compiled it wants that
* info. This includes the appropriate file which was generated by
- * make in the protocols directory (probably /usr/include/rpcsvc).
+ * make in the protocols directory (probably /usr/include/rpcsvc).
*/
#ifdef RPC_SVC
%#include "nis_svc.h"
@@ -296,10 +331,10 @@ program NIS_PROG {
/* If fetch and optionally reset statistics */
nis_taglist NIS_STATUS(nis_taglist) = 14;
-
+
/* Dump changes to directory since time in da_time */
log_result NIS_DUMPLOG(dump_args) = 15;
-
+
/* Dump contents of directory named */
log_result NIS_DUMP(dump_args) = 16;
@@ -314,16 +349,16 @@ program NIS_PROG {
/* Send 'status changed' ping to replicates */
void NIS_PING(ping_args) = 20;
-
+
/* Modify server behaviour (such as debugging) */
nis_taglist NIS_SERVSTATE(nis_taglist) = 21;
-
+
/* Create a Directory */
nis_error NIS_MKDIR(nis_name) = 22;
-
+
/* Remove a Directory */
nis_error NIS_RMDIR(nis_name) = 23;
-
+
/* Update public keys of a directory object */
nis_error NIS_UPDKEYS(nis_name) = 24;
} = 3;
@@ -372,6 +407,15 @@ program NIS_PROG {
%#define NIS_CREATE_ACC 4
%#define NIS_DESTROY_ACC 8
%/* Test macros. a == access rights, m == desired rights. */
+%#define NIS_WORLD(a, m) (((a) & (m)) != 0)
+%#define NIS_GROUP(a, m) (((a) & ((m) << 8)) != 0)
+%#define NIS_OWNER(a, m) (((a) & ((m) << 16)) != 0)
+%#define NIS_NOBODY(a, m) (((a) & ((m) << 24)) != 0)
+%/*
+% * EOL Alert - The following non-prefixed test macros are
+% * here for backward compatability, and will be not be present
+% * in future releases - use the NIS_*() macros above.
+% */
%#define WORLD(a, m) (((a) & (m)) != 0)
%#define GROUP(a, m) (((a) & ((m) << 8)) != 0)
%#define OWNER(a, m) (((a) & ((m) << 16)) != 0)
@@ -418,6 +462,8 @@ program NIS_PROG {
%#define ENTRY_LEN(obj, col) \
% (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
%
+%
+%
%#ifdef __cplusplus
%}
%#endif
@@ -429,12 +475,12 @@ program NIS_PROG {
%
%/*
% * nis_3.h
-% *
+% *
% * This file contains definitions that are only of interest to the actual
% * service daemon and client stubs. Normal users of NIS will not include
% * this file.
% *
-% * NOTE : This include file is automatically created by a combination
+% * NOTE : This include file is automatically created by a combination
% * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead
% * and then remake this file.
% */
diff --git a/nis/rpcsvc/nis_cache.h b/nis/rpcsvc/nis_cache.h
deleted file mode 100644
index ca91a22cd4..0000000000
--- a/nis/rpcsvc/nis_cache.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef __RPCSVC_NIS_CACHE_H_
-#define __RPCSVC_NIS_CACHE_H_
-
-#include <features.h>
-#include <rpc/rpc.h>
-#include <rpc/types.h>
-#include <rpcsvc/nis.h>
-
-__BEGIN_DECLS
-
-/* default cache file */
-#define CACHEFILE "/var/nis/NIS_SHARED_DIRCACHE"
-
-/* clients have to read-lock the cache file, and SVR4 locking requires that */
-/* the file be writable, but we don't want a world-writable cache file. */
-/* So... everyone agrees to use a different, world-writable file for the */
-/* locking operations, but the data is in CACHEFILE. */
-#define CACHELOCK "/usr/tmp/.NIS_DIR_CACHELOCK"
-
-/* the file containing one trusted XDR'ed directory object.
- * This has to be present for the system to work.
- */
-#define COLD_START_FILE "/var/nis/NIS_COLD_START"
-
-enum pc_status {HIT, MISS, NEAR_MISS};
-
-#define CACHEPROG ((u_long)100301)
-#define CACHE_VER_1 ((u_long)1)
-
-#define NIS_CACHE_ADD_ENTRY ((u_long)1)
-#define NIS_CACHE_REMOVE_ENTRY ((u_long)2)
-#define NIS_CACHE_READ_COLDSTART ((u_long)3)
-#define NIS_CACHE_REFRESH_ENTRY ((u_long)4)
-
-extern void *nis_cache_add_entry_1 __P ((fd_result *, CLIENT *));
-extern void *nis_cache_add_entry_1_svc __P ((fd_result *, struct svc_req *));
-extern void *nis_cache_remove_entry_1 __P ((directory_obj *, CLIENT *));
-extern void *nis_cache_remove_entry_1_svc __P ((directory_obj *,
- struct svc_req *));
-extern void *nis_cache_read_coldstart_1 __P ((void *, CLIENT *));
-extern void *nis_cache_read_coldstart_1_svc __P ((void *, struct svc_req *));
-extern void *nis_cache_refresh_entry_1 __P ((char **, CLIENT *));
-extern void *nis_cache_refresh_entry_1_svc __P ((char **, struct svc_req *));
-
-__END_DECLS
-
-#endif /* !_RPCSVC_NIS_CACHE_H_ */
diff --git a/nis/rpcsvc/nis_cache.x b/nis/rpcsvc/nis_cache.x
deleted file mode 100644
index 91870d8a48..0000000000
--- a/nis/rpcsvc/nis_cache.x
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * nis_cache.x
- *
- * Copyright (c) 1988-1992 Sun Microsystems Inc
- * All Rights Reserved.
- */
-
-%#pragma ident "@(#)nis_cache.x 1.8 92/07/14 SMI"
-
-
-#ifdef RPC_HDR
-%#include <rpc/types.h>
-%#include <rpcsvc/nis.h>
-%
-%/* default cache file */
-%#define CACHEFILE "/var/nis/NIS_SHARED_DIRCACHE"
-%
-%/* clients have to read-lock the cache file, and SVR4 locking requires that */
-%/* the file be writable, but we don't want a world-writable cache file. */
-%/* So... everyone agrees to use a different, world-writable file for the */
-%/* locking operations, but the data is in CACHEFILE. */
-%#define CACHELOCK "/usr/tmp/.NIS_DIR_CACHELOCK"
-%
-%/* the file containing one trusted XDR'ed directory object.
-% * This has to be present for the system to work.
-% */
-%#define COLD_START_FILE "/var/nis/NIS_COLD_START"
-%
-%enum pc_status {HIT, MISS, NEAR_MISS};
-%
-%extern int __nis_debuglevel;
-%
-%
-#endif
-
-#ifdef RPC_CLNT
-%#include "../gen/nis_clnt.h"
-#endif
-
-program CACHEPROG {
- version CACHE_VER_1 {
- void NIS_CACHE_ADD_ENTRY(fd_result) = 1;
- void NIS_CACHE_REMOVE_ENTRY(directory_obj) = 2;
- void NIS_CACHE_READ_COLDSTART(void) = 3;
- void NIS_CACHE_REFRESH_ENTRY(string<>) = 4;
- } = 1;
-} = 100301;
diff --git a/nis/rpcsvc/nis_object.x b/nis/rpcsvc/nis_object.x
index e13ae47b70..496a16a1e1 100644
--- a/nis/rpcsvc/nis_object.x
+++ b/nis/rpcsvc/nis_object.x
@@ -5,7 +5,7 @@
* All Rights Reserved.
*/
-%#pragma ident "@(#)nis_object.x 1.7 92/07/14 SMI"
+%#pragma ident "@(#)nis_object.x 1.9 96/07/09 SMI"
#if RPC_HDR
%
@@ -65,9 +65,14 @@ typedef string nis_name<>; /* The NIS name itself. */
* 1024 - 2047 are defined to be private to a particular tree.
* 2048 - 4095 are defined to be user defined.
* 4096 - ... are reserved for future use.
+ *
+ * EOL Alert - The non-prefixed names are present for backward
+ * compatability only, and will not exist in future releases. Use
+ * the NIS_* names for future compatability.
*/
enum zotypes {
+
BOGUS_OBJ = 0, /* Uninitialized object structure */
NO_OBJ = 1, /* NULL object (no data) */
DIRECTORY_OBJ = 2, /* Directory object describing domain */
@@ -75,7 +80,16 @@ enum zotypes {
TABLE_OBJ = 4, /* Table object (a database schema) */
ENTRY_OBJ = 5, /* Entry object (a database record) */
LINK_OBJ = 6, /* A name link. */
- PRIVATE_OBJ = 7 /* Private object (all opaque data) */
+ PRIVATE_OBJ = 7, /* Private object (all opaque data) */
+
+ NIS_BOGUS_OBJ = 0, /* Uninitialized object structure */
+ NIS_NO_OBJ = 1, /* NULL object (no data) */
+ NIS_DIRECTORY_OBJ = 2, /* Directory object describing domain */
+ NIS_GROUP_OBJ = 3, /* Group object (a list of names) */
+ NIS_TABLE_OBJ = 4, /* Table object (a database schema) */
+ NIS_ENTRY_OBJ = 5, /* Entry object (a database record) */
+ NIS_LINK_OBJ = 6, /* A name link. */
+ NIS_PRIVATE_OBJ = 7 /* Private object (all opaque data) */
};
/*
@@ -230,21 +244,21 @@ struct table_obj {
* This union joins together all of the currently known objects.
*/
union objdata switch (zotypes zo_type) {
- case DIRECTORY_OBJ :
+ case NIS_DIRECTORY_OBJ :
struct directory_obj di_data;
- case GROUP_OBJ :
+ case NIS_GROUP_OBJ :
struct group_obj gr_data;
- case TABLE_OBJ :
+ case NIS_TABLE_OBJ :
struct table_obj ta_data;
- case ENTRY_OBJ:
+ case NIS_ENTRY_OBJ:
struct entry_obj en_data;
- case LINK_OBJ :
+ case NIS_LINK_OBJ :
struct link_obj li_data;
- case PRIVATE_OBJ :
+ case NIS_PRIVATE_OBJ :
opaque po_data<>;
- case NO_OBJ :
+ case NIS_NO_OBJ :
void;
- case BOGUS_OBJ :
+ case NIS_BOGUS_OBJ :
void;
default :
void;
diff --git a/nis/rpcsvc/nis_tags.h b/nis/rpcsvc/nis_tags.h
index 30bdff6d1a..19a5bcab19 100644
--- a/nis/rpcsvc/nis_tags.h
+++ b/nis/rpcsvc/nis_tags.h
@@ -12,7 +12,7 @@
#ifndef _RPCSVC_NIS_TAGS_H
#define _RPCSVC_NIS_TAGS_H
-#pragma ident "@(#)nis_tags.h 1.13 95/02/17 SMI"
+#pragma ident "@(#)nis_tags.h 1.16 96/10/25 SMI"
/* from file: zns_tags.h 1.7 Copyright (c) 1990 Sun Microsystems */
#ifdef __cplusplus
@@ -40,6 +40,9 @@ extern "C" {
#define REM_RESERVED (1<<12) /* Spare REM semantic */
#define MOD_EXCLUSIVE (1<<13) /* Modify no overwrite on modified keys */
+/* Lookup and List function flags (continued) */
+#define SOFT_LOOKUP (1<<14) /* The "old default" return on failure */
+
/* Transport specific modifications to the operation */
#define USE_DGRAM (1<<16) /* Use a datagram transport */
#define NO_AUTHINFO (1<<17) /* Don't bother attaching auth info */
@@ -63,6 +66,8 @@ extern "C" {
#define TAG_TCACHE_ALL 9 /* Flush entire table cache */
#define TAG_GCACHE_ONE 10 /* Flush one group object */
#define TAG_DCACHE_ONE_REFRESH 11 /* Flush and refresh one DO */
+#define TAG_READONLY 12 /* Set read only mode */
+#define TAG_READWRITE 14 /* Reset read-write mode */
#define TAG_OPSTATS 2048 /* NIS+ operations statistics */
#define TAG_THREADS 2049 /* Child process/thread status */
diff --git a/nis/rpcsvc/nislib.h b/nis/rpcsvc/nislib.h
index 73b3804e85..016bedc769 100644
--- a/nis/rpcsvc/nislib.h
+++ b/nis/rpcsvc/nislib.h
@@ -224,29 +224,14 @@ extern bool_t nis_write_obj __P ((const char *file, const nis_object *obj));
*/
extern directory_obj *nis_clone_directory __P ((const directory_obj *src,
directory_obj *dest));
-extern group_obj *nis_clone_group __P ((const group_obj *src,
- group_obj *dest));
-extern table_obj *nis_clone_table __P ((const table_obj *src,
- table_obj *dest));
-extern entry_obj *nis_clone_entry __P ((const entry_obj *src,
- entry_obj *dest));
-extern link_obj *nis_clone_link __P ((const link_obj *src, link_obj *dest));
-extern objdata *nis_clone_objdata __P ((const objdata *src, objdata *dest));
extern nis_result *nis_clone_result __P ((const nis_result *src,
nis_result *dest));
/* nis_free - nis_freeresult */
extern void nis_freeresult __P ((nis_result *result));
/* (XXX THE FOLLOWING ARE INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
-extern void nis_free_attr __P ((nis_attr *attr));
extern void nis_free_request __P ((ib_request *req));
-extern void nis_free_endpoints __P ((endpoint *ep, unsigned int count));
-extern void nis_free_servers __P ((nis_server *machine, unsigned int count));
extern void nis_free_directory __P ((directory_obj *dirobj));
-extern void nis_free_group __P ((group_obj *grpobj));
-extern void nis_free_table __P ((table_obj *tblobj));
-extern void nis_free_entry __P ((entry_obj *enobj));
-extern void nis_free_link __P ((link_obj *lnkobj));
extern void nis_free_object __P ((nis_object *obj));
/* (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
@@ -255,10 +240,9 @@ extern nis_name __nis_default_group __P ((char *));
extern u_long __nis_default_ttl __P ((char *));
extern u_long __nis_default_access __P ((char *, u_long));
extern fd_result *__nis_finddirectory __P ((directory_obj *, const_nis_name));
+extern void __free_fdresult __P ((fd_result *));
extern u_long __nis_hash __P ((const void *keyarg, register size_t len));
-extern log_result *__nis_dumplog __P ((nis_server *,nis_name, u_long));
-extern log_result *__nis_dump __P ((nis_server *, nis_name,
- int (*)(nis_name, nis_object *, void *)));
+
/* NIS+ cache locking */
extern int __nis_lock_cache __P ((void));
extern int __nis_unlock_cache __P ((void));
diff --git a/nis/rpcsvc/ypupd.h b/nis/rpcsvc/ypupd.h
index dace7824d4..d7ce0d76d0 100644
--- a/nis/rpcsvc/ypupd.h
+++ b/nis/rpcsvc/ypupd.h
@@ -85,4 +85,6 @@ extern u_int * ypu_delete_1_svc __P ((ypdelete_args *, struct svc_req *));
extern u_int * ypu_store_1 __P ((ypupdate_args *, CLIENT *));
extern u_int * ypu_store_1_svc __P ((ypupdate_args *, struct svc_req *));
+__END_DECLS
+
#endif /* !__RPCSVC_YPUPD_H__ */