nis_remove.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Copyright (C) 1997-2026 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. #include <rpcsvc/nis.h>
  15. #include <shlib-compat.h>
  16. #include "nis_xdr.h"
  17. #include "nis_intern.h"
  18. nis_result *
  19. nis_remove (const_nis_name name, const nis_object *obj)
  20. {
  21. nis_result *res;
  22. nis_error status;
  23. struct ns_request req;
  24. res = calloc (1, sizeof (nis_result));
  25. if (res == NULL)
  26. return NULL;
  27. req.ns_name = (char *)name;
  28. if (obj != NULL)
  29. {
  30. req.ns_object.ns_object_len = 1;
  31. req.ns_object.ns_object_val = nis_clone_object (obj, NULL);
  32. }
  33. else
  34. {
  35. req.ns_object.ns_object_len = 0;
  36. req.ns_object.ns_object_val = NULL;
  37. }
  38. if ((status = __do_niscall (name, NIS_REMOVE, (xdrproc_t) _xdr_ns_request,
  39. (caddr_t) &req, (xdrproc_t) _xdr_nis_result,
  40. (caddr_t) res, MASTER_ONLY,
  41. NULL)) != NIS_SUCCESS)
  42. NIS_RES_STATUS (res) = status;
  43. nis_destroy_object (req.ns_object.ns_object_val);
  44. return res;
  45. }
  46. libnsl_hidden_nolink_def (nis_remove, GLIBC_2_1)