/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following functions.
- process_networkupdate
1 /***************************************
2 $Revision: 1.4 $
3
4 process.cc
5
6 Status: NOT REVIEWED, TESTED
7
8 Author(s): Engin Gunduz
9
10 ******************/ /******************
11 Modification History:
12 engin (01/03/2001) Created.
13 ******************/ /******************
14 Copyright (c) 2001 RIPE NCC
15
16 All Rights Reserved
17
18 Permission to use, copy, modify, and distribute this software and its
19 documentation for any purpose and without fee is hereby granted,
20 provided that the above copyright notice appear in all copies and that
21 both that copyright notice and this permission notice appear in
22 supporting documentation, and that the name of the author not be
23 used in advertising or publicity pertaining to distribution of the
24 software without specific, written prior permission.
25
26 THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
27 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
28 AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
29 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
30 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
31 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32 ***************************************/
33
34
35
36
37
38 #include "dbupdate.h"
39 #include "process.h"
40
41 extern char * copyright_notice;
42 extern char * netupdclientIP;
43
44 extern int count_successful;
45 extern int count_unsuccessful;
46
47 /* process_networkupdate function processes network updates. Since dbupdate is
48 invoked by inetd for networkupdates, we simply read the standard input to get
49 the objects. It must process an object as soon as it reads it from the stdin.
50 That is, there is no need for keeping a linked list of objects, so there
51 won't be any object reordering */
52
53 void process_networkupdate(credentials_struct credentials,
/* [<][>][^][v][top][bottom][index][help] */
54 GHashTable * AUTO_NIC_hdl_hash,
55 char * ack_file_name,
56 GHashTable * ntfy_hash,
57 GHashTable * forw_hash,
58 GHashTable * cross_hash){
59
60
61 char *object = NULL;
62 char * line;
63 int result = 0;
64 ip_addr_t *peerip;
65
66 /* here we will check if the peer is authorised to do networkupdates */
67
68 /* get the IP of the peer. */
69 peerip = (ip_addr_t *)malloc(sizeof(ip_addr_t));
70 SK_getpeerip(0, peerip);
71
72 /* convert it to a char *, for reporting */
73 netupdclientIP = (char *)malloc(64);
74 IP_addr_b2a(peerip, netupdclientIP, 64);
75
76 /* and check if the peer has permission to do networkupdate
77 As the "source" to AA_can_networkupdate we use the first
78 updatable source. Since currently we don't support multiple
79 sources, this is not a problem but when we support it, we must change this.
80 Or, rather, we can simply change AA_can_networkupdate not to ask for
81 a source. This probably also requires changing aaa table of the ripadmin
82 db. */
83 if(!AA_can_networkupdate(peerip, current_source)){
84
85 printf("\n\n***You are not authorized to do network updates***\n\n");
86 close(0);
87 exit(1);
88
89 }
90
91 /* print the copyright notice (PW_RESP_HEADER) */
92 printf("\n%s\n", copyright_notice);
93 fflush(0);
94
95
96 }/* process_networkupdate */
97
98
99
100