yp_server.c (14240) | yp_server.c (14262) |
---|---|
1/* 2 * Copyright (c) 1995 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 31 unchanged lines hidden (view full) --- 40#include <errno.h> 41#include <sys/types.h> 42#include <sys/socket.h> 43#include <netinet/in.h> 44#include <arpa/inet.h> 45#include <rpc/rpc.h> 46 47#ifndef lint | 1/* 2 * Copyright (c) 1995 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 31 unchanged lines hidden (view full) --- 40#include <errno.h> 41#include <sys/types.h> 42#include <sys/socket.h> 43#include <netinet/in.h> 44#include <arpa/inet.h> 45#include <rpc/rpc.h> 46 47#ifndef lint |
48static char rcsid[] = "$Id: yp_server.c,v 1.2 1995/12/23 21:35:35 wpaul Exp $"; | 48static char rcsid[] = "$Id: yp_server.c,v 1.3 1996/02/26 02:23:39 wpaul Exp $"; |
49#endif /* not lint */ 50 51int forked = 0; 52int children = 0; 53DB *spec_dbp = NULL; /* Special global DB handle for ypproc_all. */ 54 | 49#endif /* not lint */ 50 51int forked = 0; 52int children = 0; 53DB *spec_dbp = NULL; /* Special global DB handle for ypproc_all. */ 54 |
55/* 56 * NIS v2 support. This is where most of the action happens. 57 */ 58 |
|
55void * 56ypproc_null_2_svc(void *argp, struct svc_req *rqstp) 57{ 58 static char * result; 59 static char rval = 0; 60 61 if (yp_access(NULL, (struct svc_req *)rqstp)) 62 return(NULL); --- 630 unchanged lines hidden (view full) --- 693 yp_error("yp_maplist_create failed"); 694 result.stat = YP_YPERR; 695 return(&result); 696 } else 697 result.stat = YP_TRUE; 698 699 return (&result); 700} | 59void * 60ypproc_null_2_svc(void *argp, struct svc_req *rqstp) 61{ 62 static char * result; 63 static char rval = 0; 64 65 if (yp_access(NULL, (struct svc_req *)rqstp)) 66 return(NULL); --- 630 unchanged lines hidden (view full) --- 697 yp_error("yp_maplist_create failed"); 698 result.stat = YP_YPERR; 699 return(&result); 700 } else 701 result.stat = YP_TRUE; 702 703 return (&result); 704} |
705 706/* 707 * NIS v1 support. The nullproc, domain and domain_nonack 708 * functions from v1 are identical to those in v2, so all 709 * we have to do is hand off to them. 710 * 711 * The other functions are mostly just wrappers around their v2 712 * counterparts. For example, for the v1 'match' procedure, we 713 * crack open the argument structure, make a request to the v2 714 * 'match' function, repackage the data into a v1 response and 715 * then send it on its way. 716 * 717 * Note that we don't support the pull, push and get procedures. 718 * There's little documentation available to show what they 719 * do, and I suspect they're meant largely for map transfers 720 * between master and slave servers. 721 */ 722 723void * 724ypoldproc_null_1_svc(void *argp, struct svc_req *rqstp) 725{ 726 return(ypproc_null_2_svc(argp, rqstp)); 727} 728 729bool_t * 730ypoldproc_domain_1_svc(domainname *argp, struct svc_req *rqstp) 731{ 732 return(ypproc_domain_2_svc(argp, rqstp)); 733} 734 735bool_t * 736ypoldproc_domain_nonack_1_svc(domainname *argp, struct svc_req *rqstp) 737{ 738 return (ypproc_domain_nonack_2_svc(argp, rqstp)); 739} 740 741ypresponse * 742ypoldproc_match_1_svc(yprequest *argp, struct svc_req *rqstp) 743{ 744 static ypresponse result; 745 ypresp_val *v2_result; 746 747 result.yp_resptype = YPRESP_VAL; 748 749 if (argp->yp_reqtype != YPREQ_KEY) { 750 result.ypresponse_u.yp_resp_valtype.stat = YP_BADARGS; 751 return(&result); 752 } 753 754 v2_result = ypproc_match_2_svc(&argp->yprequest_u.yp_req_keytype,rqstp); 755 if (v2_result == NULL) 756 return(NULL); 757 758 bcopy((char *)v2_result, 759 (char *)&result.ypresponse_u.yp_resp_valtype, 760 sizeof(ypresp_val)); 761 762 return (&result); 763} 764 765ypresponse * 766ypoldproc_first_1_svc(yprequest *argp, struct svc_req *rqstp) 767{ 768 static ypresponse result; 769 ypresp_key_val *v2_result; 770 771 result.yp_resptype = YPRESP_KEY_VAL; 772 773 if (argp->yp_reqtype != YPREQ_NOKEY) { 774 result.ypresponse_u.yp_resp_key_valtype.stat = YP_BADARGS; 775 return(&result); 776 } 777 778 v2_result = ypproc_first_2_svc(&argp->yprequest_u.yp_req_nokeytype, 779 rqstp); 780 if (v2_result == NULL) 781 return(NULL); 782 783 bcopy((char *)v2_result, 784 (char *)&result.ypresponse_u.yp_resp_key_valtype, 785 sizeof(ypresp_key_val)); 786 787 return (&result); 788} 789 790ypresponse * 791ypoldproc_next_1_svc(yprequest *argp, struct svc_req *rqstp) 792{ 793 static ypresponse result; 794 ypresp_key_val *v2_result; 795 796 result.yp_resptype = YPRESP_KEY_VAL; 797 798 if (argp->yp_reqtype != YPREQ_KEY) { 799 result.ypresponse_u.yp_resp_key_valtype.stat = YP_BADARGS; 800 return(&result); 801 } 802 803 v2_result = ypproc_next_2_svc(&argp->yprequest_u.yp_req_keytype,rqstp); 804 if (v2_result == NULL) 805 return(NULL); 806 807 bcopy((char *)v2_result, 808 (char *)&result.ypresponse_u.yp_resp_key_valtype, 809 sizeof(ypresp_key_val)); 810 811 return (&result); 812} 813 814ypresponse * 815ypoldproc_poll_1_svc(yprequest *argp, struct svc_req *rqstp) 816{ 817 static ypresponse result; 818 ypresp_master *v2_result1; 819 ypresp_order *v2_result2; 820 821 result.yp_resptype = YPRESP_MAP_PARMS; 822 result.ypresponse_u.yp_resp_map_parmstype.domain = 823 argp->yprequest_u.yp_req_nokeytype.domain; 824 result.ypresponse_u.yp_resp_map_parmstype.map = 825 argp->yprequest_u.yp_req_nokeytype.map; 826 /* 827 * Hmm... there is no 'status' value in the 828 * yp_resp_map_parmstype structure, so I have to 829 * guess at what to do to indicate a failure. 830 * I hope this is right. 831 */ 832 result.ypresponse_u.yp_resp_map_parmstype.ordernum = 0; 833 result.ypresponse_u.yp_resp_map_parmstype.peer = ""; 834 835 if (argp->yp_reqtype != YPREQ_MAP_PARMS) { 836 return(&result); 837 } 838 839 v2_result1 = ypproc_master_2_svc(&argp->yprequest_u.yp_req_nokeytype, 840 rqstp); 841 if (v2_result1 == NULL) 842 return(NULL); 843 844 if (v2_result1->stat != YP_TRUE) { 845 return(&result); 846 } 847 848 v2_result2 = ypproc_order_2_svc(&argp->yprequest_u.yp_req_nokeytype, 849 rqstp); 850 if (v2_result2 == NULL) 851 return(NULL); 852 853 if (v2_result2->stat != YP_TRUE) { 854 return(&result); 855 } 856 857 result.ypresponse_u.yp_resp_map_parmstype.peer = 858 v2_result1->peer; 859 result.ypresponse_u.yp_resp_map_parmstype.ordernum = 860 v2_result2->ordernum; 861 862 return (&result); 863} 864 865ypresponse * 866ypoldproc_push_1_svc(yprequest *argp, struct svc_req *rqstp) 867{ 868 static ypresponse result; 869 870 /* 871 * Not implemented. 872 */ 873 874 return (&result); 875} 876 877ypresponse * 878ypoldproc_pull_1_svc(yprequest *argp, struct svc_req *rqstp) 879{ 880 static ypresponse result; 881 882 /* 883 * Not implemented. 884 */ 885 886 return (&result); 887} 888 889ypresponse * 890ypoldproc_get_1_svc(yprequest *argp, struct svc_req *rqstp) 891{ 892 static ypresponse result; 893 894 /* 895 * Not implemented. 896 */ 897 898 return (&result); 899} |
|