Kannel: Open Source WAP and SMS gateway  svn-r5335
kannel.c
Go to the documentation of this file.
1 /* ====================================================================
2  * The Kannel Software License, Version 1.0
3  *
4  * Copyright (c) 2001-2018 Kannel Group
5  * Copyright (c) 1998-2001 WapIT Ltd.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  *
20  * 3. The end-user documentation included with the redistribution,
21  * if any, must include the following acknowledgment:
22  * "This product includes software developed by the
23  * Kannel Group (http://www.kannel.org/)."
24  * Alternately, this acknowledgment may appear in the software itself,
25  * if and wherever such third-party acknowledgments normally appear.
26  *
27  * 4. The names "Kannel" and "Kannel Group" must not be used to
28  * endorse or promote products derived from this software without
29  * prior written permission. For written permission, please
30  * contact org@kannel.org.
31  *
32  * 5. Products derived from this software may not be called "Kannel",
33  * nor may "Kannel" appear in their name, without prior written
34  * permission of the Kannel Group.
35  *
36  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39  * DISCLAIMED. IN NO EVENT SHALL THE KANNEL GROUP OR ITS CONTRIBUTORS
40  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
41  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
42  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
43  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
44  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
45  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Kannel Group. For more information on
51  * the Kannel Group, please see <http://www.kannel.org/>.
52  *
53  * Portions of this software are based upon software originally written at
54  * WapIT Ltd., Helsinki, Finland for the Kannel project.
55  */
56 
57 #include "gwlib/gwlib.h"
58 #include "smscconn.h"
59 #include "smscconn_p.h"
60 #include "bb_smscconn_cb.h"
61 #include "msg.h"
62 #include "sms.h"
63 #include "dlr.h"
64 #include "urltrans.h"
65 #include "meta_data.h"
66 
67 #include "../smsc_http_p.h"
68 
69 /*----------------------------------------------------------------
70  * Kannel
71  *
72  * This type allows concatenation of Kannel instances, ie:
73  *
74  * <smsc>--<bearerbox2><smsbox2>--HTTP--<smsc_http><bearerbox1><smsbox1>
75  *
76  * Where MT messages are injected via the sendsms HTTP interface at smsbox1,
77  * forwarded to bearerbo1 and routed via the SMSC HTTP type kannel to
78  * sendsms HTTP interface of smsbox2 and further on.
79  *
80  * This allows chaining of Kannel instances for MO and MT traffic.
81  *
82  * DLR handling:
83  * For DLR handling we have the usual effect that the "last" smsbox instance
84  * of the chain is signaling the DLR-URL, since the last instance receives
85  * the DLR from the upstream SMSC and the associated smsbox triggers the
86  * DLR-URL.
87  * For some considerations this is not what we want. If we want to transport
88  * the orginal DLR-URL to the "first" smsbox instance of the calling chain
89  * then we need to define a 'dlr-url' config directive in the smsc group.
90  * This value defines the inbound MO/DLR port of our own smsc group and
91  * maps arround the orginal DLR-URL. So the next smsbox does not signal the
92  * orginal DLR-URL, but our own smsc group instance with the DLR, and we can
93  * forward on to smsbox and possibly further on the chain to the first
94  * instance.
95  *
96  * Example: (consider the 2 chain architecture from above)
97  * A MT is put to smsbox1 with dlr-url=http://foobar/aaa as DLR-URL. The MT
98  * is forwarded to bearerbox.
99  * If no 'dlr-url' is given in the smsc HTTP for the next smsbox2, then we
100  * simply pass the same value to smsbox2. Resulting that smsbox2 will call
101  * the DLR-URL when we receive a DLR from the upstream SMSC connection of
102  * bearerbox2.
103  * If 'dlr-url = http://localhost:15015/' is given in the smsc HTTP for the
104  * next smsbox2, then we map the orginal DLR-URL into this value, resulting
105  * in a dlr-url=http://lcoalhost:15015/&dlr-url=http://foobar/aaa call to
106  * smsbox2. So smsbox2 is not signaling http://foobar/aaa directly, but our
107  * own bearerbox1's smsc HTTP port for MO/DLR receive.
108  */
109 
110 enum { HEX_NOT_UPPERCASE = 0 };
111 
112 
113 static int kannel_send_sms(SMSCConn *conn, Msg *sms)
114 {
115  ConnData *conndata = conn->data;
116  Octstr *url;
117  List *headers;
118 
119  if (!conndata->no_sep) {
120  url = octstr_format("%S?"
121  "username=%E&password=%E&to=%E&text=%E",
124  sms->sms.receiver, sms->sms.msgdata);
125  } else {
126  Octstr *msgdata = octstr_duplicate(sms->sms.msgdata);
127 
129  url = octstr_format("%S?"
130  "username=%E&password=%E&to=%E&text=%S",
133  sms->sms.receiver, msgdata);
134  octstr_destroy(msgdata);
135  }
136 
137  if (octstr_len(sms->sms.udhdata)) {
138  if (!conndata->no_sep) {
139  octstr_format_append(url, "&udh=%E", sms->sms.udhdata);
140  } else {
141  Octstr *udhdata = octstr_duplicate(sms->sms.udhdata);
142 
144  octstr_format_append(url, "&udh=%S", udhdata);
145  octstr_destroy(udhdata);
146  }
147  }
148 
149  if (!conndata->no_sender)
150  octstr_format_append(url, "&from=%E", sms->sms.sender);
151  if (sms->sms.mclass != MC_UNDEF)
152  octstr_format_append(url, "&mclass=%d", sms->sms.mclass);
153  if (!conndata->no_coding && sms->sms.coding != DC_UNDEF)
154  octstr_format_append(url, "&coding=%d", sms->sms.coding);
155 
156  /* Obey that smsbox's sendsms HTTP interface is still expecting
157  * WINDOWS-1252 as default charset, while all other internal parts
158  * use UTF-8 as internal encoding. This means, when we pass a SMS
159  * into a next Kannel instance, we need to let the smsbox know which
160  * charset we have in use.
161  * XXX TODO: change smsbox interface to use UTF-8 as default
162  * in next major release. */
163  if (sms->sms.coding == DC_7BIT)
164  octstr_append_cstr(url, "&charset=UTF-8");
165  else if (sms->sms.coding == DC_UCS2)
166  octstr_append_cstr(url, "&charset=UTF-16BE");
167 
168  if (sms->sms.mwi != MWI_UNDEF)
169  octstr_format_append(url, "&mwi=%d", sms->sms.mwi);
170  if (sms->sms.account) /* prepend account with local username */
171  octstr_format_append(url, "&account=%E:%E", sms->sms.service, sms->sms.account);
172  if (sms->sms.binfo) /* prepend billing info */
173  octstr_format_append(url, "&binfo=%S", sms->sms.binfo);
174  if (sms->sms.smsc_id) /* proxy the smsc-id to the next instance */
175  octstr_format_append(url, "&smsc=%S", sms->sms.smsc_id);
176  if (conndata->dlr_url) {
177  char id[UUID_STR_LEN + 1];
178  Octstr *mid;
179 
180  /* create Octstr from UUID */
181  uuid_unparse(sms->sms.id, id);
182  mid = octstr_create(id);
183 
184  octstr_format_append(url, "&dlr-url=%E", conndata->dlr_url);
185 
186  /* encapsulate the original DLR-URL, escape code for DLR mask
187  * and message id */
188  octstr_format_append(url, "%E%E%E%E%E",
189  octstr_imm("&dlr-url="), sms->sms.dlr_url != NULL ? sms->sms.dlr_url : octstr_imm(""),
190  octstr_imm("&dlr-mask=%d"),
191  octstr_imm("&dlr-mid="), mid);
192 
193  octstr_destroy(mid);
194  } else if (sms->sms.dlr_url != NULL)
195  octstr_format_append(url, "&dlr-url=%E", sms->sms.dlr_url);
196  if (sms->sms.dlr_mask != DLR_UNDEFINED && sms->sms.dlr_mask != DLR_NOTHING)
197  octstr_format_append(url, "&dlr-mask=%d", sms->sms.dlr_mask);
198 
199  if (sms->sms.validity != SMS_PARAM_UNDEFINED)
200  octstr_format_append(url, "&validity=%ld", (sms->sms.validity - time(NULL)) / 60);
201  if (sms->sms.deferred != SMS_PARAM_UNDEFINED)
202  octstr_format_append(url, "&deferred=%ld", (sms->sms.deferred - time(NULL)) / 60);
203 
204  headers = gwlist_create();
205  debug("smsc.http.kannel", 0, "HTTP[%s]: Start request",
206  octstr_get_cstr(conn->id));
208  NULL, 0, sms, NULL);
209 
211  http_destroy_headers(headers);
212 
213  return 0;
214 }
215 
216 static void kannel_parse_reply(SMSCConn *conn, Msg *msg, int status,
217  List *headers, Octstr *body)
218 {
219  /* Test on three cases:
220  * 1. an smsbox reply of an remote kannel instance
221  * 2. an smsc_http response (if used for MT to MO looping)
222  * 3. an smsbox reply of partly successful sendings */
223  if ((status == HTTP_OK || status == HTTP_ACCEPTED)
224  && (octstr_case_compare(body, octstr_imm("0: Accepted for delivery")) == 0 ||
225  octstr_case_compare(body, octstr_imm("Sent.")) == 0 ||
226  octstr_case_compare(body, octstr_imm("Ok.")) == 0 ||
227  octstr_ncompare(body, octstr_imm("Result: OK"),10) == 0)) {
228  char id[UUID_STR_LEN + 1];
229  Octstr *mid;
230 
231  /* create Octstr from UUID */
232  uuid_unparse(msg->sms.id, id);
233  mid = octstr_create(id);
234 
235  /* add to our own DLR storage */
236  if (DLR_IS_ENABLED_DEVICE(msg->sms.dlr_mask))
237  dlr_add(conn->id, mid, msg, 0);
238 
239  octstr_destroy(mid);
240 
241  bb_smscconn_sent(conn, msg, NULL);
242  } else {
245  }
246 }
247 
248 
250  List *headers, Octstr *body, List *cgivars)
251 {
252  ConnData *conndata = conn->data;
253  Octstr *user, *pass, *from, *to, *text, *udh, *account, *binfo, *charset;
254  Octstr *dlrmid, *dlrerr;
255  Octstr *tmp_string, *retmsg;
256  int mclass, mwi, coding, validity, deferred, dlrmask;
257  List *reply_headers;
258  int ret;
259 
260  mclass = mwi = coding = validity =
261  deferred = dlrmask = SMS_PARAM_UNDEFINED;
262 
263  user = http_cgi_variable(cgivars, "username");
264  pass = http_cgi_variable(cgivars, "password");
265  from = http_cgi_variable(cgivars, "from");
266  to = http_cgi_variable(cgivars, "to");
267  text = http_cgi_variable(cgivars, "text");
268  udh = http_cgi_variable(cgivars, "udh");
269  charset = http_cgi_variable(cgivars, "charset");
270  account = http_cgi_variable(cgivars, "account");
271  binfo = http_cgi_variable(cgivars, "binfo");
272  dlrmid = http_cgi_variable(cgivars, "dlr-mid");
273  tmp_string = http_cgi_variable(cgivars, "flash");
274  if (tmp_string) {
275  sscanf(octstr_get_cstr(tmp_string),"%d", &mclass);
276  }
277  tmp_string = http_cgi_variable(cgivars, "mclass");
278  if (tmp_string) {
279  sscanf(octstr_get_cstr(tmp_string),"%d", &mclass);
280  }
281  tmp_string = http_cgi_variable(cgivars, "mwi");
282  if (tmp_string) {
283  sscanf(octstr_get_cstr(tmp_string),"%d", &mwi);
284  }
285  tmp_string = http_cgi_variable(cgivars, "coding");
286  if (tmp_string) {
287  sscanf(octstr_get_cstr(tmp_string),"%d", &coding);
288  }
289  tmp_string = http_cgi_variable(cgivars, "validity");
290  if (tmp_string) {
291  sscanf(octstr_get_cstr(tmp_string),"%d", &validity);
292  }
293  tmp_string = http_cgi_variable(cgivars, "deferred");
294  if (tmp_string) {
295  sscanf(octstr_get_cstr(tmp_string),"%d", &deferred);
296  }
297  tmp_string = http_cgi_variable(cgivars, "dlr-mask");
298  if (tmp_string) {
299  sscanf(octstr_get_cstr(tmp_string),"%d", &dlrmask);
300  }
301  dlrerr = http_cgi_variable(cgivars, "dlr-err");
302 
303  debug("smsc.http.kannel", 0, "HTTP[%s]: Received an HTTP request",
304  octstr_get_cstr(conn->id));
305 
306  if (user == NULL || pass == NULL ||
307  octstr_compare(user, conndata->username) != 0 ||
308  octstr_compare(pass, conndata->password) != 0) {
309 
310  error(0, "HTTP[%s]: Authorization failure",
311  octstr_get_cstr(conn->id));
312  retmsg = octstr_create("Authorization failed for sendsms");
313  } else if (dlrmask != 0 && dlrmid != NULL) {
314  /* we got a DLR, and we don't require additional values */
315  Msg *dlrmsg;
316 
317  dlrmsg = dlr_find(conn->id,
318  dlrmid, /* message id */
319  to, /* destination */
320  dlrmask, 0);
321 
322  if (dlrmsg != NULL) {
323  dlrmsg->sms.sms_type = report_mo;
324  dlrmsg->sms.msgdata = octstr_duplicate(text);
325  dlrmsg->sms.account = octstr_duplicate(conndata->username);
326 
327  debug("smsc.http.kannel", 0, "HTTP[%s]: Received DLR for DLR-URL <%s>",
328  octstr_get_cstr(conn->id), octstr_get_cstr(dlrmsg->sms.dlr_url));
329 
330  if (dlrerr != NULL) {
331  /* pass errorcode as is */
332  if (dlrmsg->sms.meta_data == NULL)
333  dlrmsg->sms.meta_data = octstr_create("");
334 
335  meta_data_set_value(dlrmsg->sms.meta_data, METADATA_DLR_GROUP,
337  }
338 
339  ret = bb_smscconn_receive(conn, dlrmsg);
340  if (ret == -1)
341  retmsg = octstr_create("Not accepted");
342  else
343  retmsg = octstr_create("Sent.");
344  } else {
345  error(0,"HTTP[%s]: Got DLR but could not find message or was not interested "
346  "in it id<%s> dst<%s>, type<%d>",
347  octstr_get_cstr(conn->id), octstr_get_cstr(dlrmid),
348  octstr_get_cstr(to), dlrmask);
349  retmsg = octstr_create("Unknown DLR, not accepted");
350  }
351  }
352  else if (from == NULL || to == NULL || text == NULL) {
353 
354  error(0, "HTTP[%s]: Insufficient args",
355  octstr_get_cstr(conn->id));
356  retmsg = octstr_create("Insufficient args, rejected");
357  }
358  else if (udh != NULL && (octstr_len(udh) != octstr_get_char(udh, 0) + 1)) {
359  error(0, "HTTP[%s]: UDH field misformed, rejected",
360  octstr_get_cstr(conn->id));
361  retmsg = octstr_create("UDH field misformed, rejected");
362  }
363  else if (udh != NULL && octstr_len(udh) > MAX_SMS_OCTETS) {
364  error(0, "HTTP[%s]: UDH field is too long, rejected",
365  octstr_get_cstr(conn->id));
366  retmsg = octstr_create("UDH field is too long, rejected");
367  }
368  else {
369  /* we got a normal MO SMS */
370  Msg *msg;
371  msg = msg_create(sms);
372 
373  debug("smsc.http.kannel", 0, "HTTP[%s]: Constructing new SMS",
374  octstr_get_cstr(conn->id));
375 
376  msg->sms.service = octstr_duplicate(user);
377  msg->sms.sender = octstr_duplicate(from);
378  msg->sms.receiver = octstr_duplicate(to);
379  msg->sms.msgdata = octstr_duplicate(text);
380  msg->sms.udhdata = octstr_duplicate(udh);
381 
382  msg->sms.smsc_id = octstr_duplicate(conn->id);
383  msg->sms.time = time(NULL);
384  msg->sms.mclass = mclass;
385  msg->sms.mwi = mwi;
386  msg->sms.coding = coding;
387  msg->sms.validity = (validity == SMS_PARAM_UNDEFINED ? validity : time(NULL) + validity * 60);
388  msg->sms.deferred = (deferred == SMS_PARAM_UNDEFINED ? deferred : time(NULL) + deferred * 60);
389  msg->sms.account = octstr_duplicate(account);
390  msg->sms.binfo = octstr_duplicate(binfo);
391 
392  /* re-encode content if necessary */
393  if (sms_charset_processing(charset, msg->sms.msgdata, msg->sms.coding) == -1) {
394  error(0, "HTTP[%s]: Charset or body misformed, rejected",
395  octstr_get_cstr(conn->id));
396  retmsg = octstr_create("Charset or body misformed, rejected");
397  }
398  else {
399 
400  ret = bb_smscconn_receive(conn, msg);
401  if (ret == -1)
402  retmsg = octstr_create("Not accepted");
403  else
404  retmsg = octstr_create("Sent.");
405  }
406  }
407 
408  reply_headers = gwlist_create();
409  http_header_add(reply_headers, "Content-Type", "text/plain");
410  debug("smsc.http.kannel", 0, "HTTP[%s]: Sending reply",
411  octstr_get_cstr(conn->id));
412  http_send_reply(client, HTTP_ACCEPTED, reply_headers, retmsg);
413 
414  octstr_destroy(retmsg);
415  http_destroy_headers(reply_headers);
416 }
417 
420  .parse_reply = kannel_parse_reply,
421  .receive_sms = kannel_receive_sms,
422 };
void error(int err, const char *fmt,...)
Definition: log.c:648
#define MWI_UNDEF
Definition: sms.h:99
#define MAX_SMS_OCTETS
Definition: sms.h:129
Octstr * dlr_url
Definition: smsc_http_p.h:94
static int coding
Definition: mtbatch.c:102
void http_header_add(List *headers, char *name, char *contents)
Definition: http.c:2886
int(* send_sms)(SMSCConn *conn, Msg *msg)
Definition: smsc_http_p.h:76
int no_sep
Definition: smsc_http_p.h:101
Definition: msg.h:109
Octstr * id
Definition: smscconn_p.h:174
void * data
Definition: smscconn_p.h:250
static void client(int port)
Definition: test_udp.c:77
#define METADATA_DLR_GROUP_ERRORCODE
Definition: meta_data.h:71
HTTPCaller * http_ref
Definition: smsc_http_p.h:86
#define DLR_NOTHING
Definition: dlr.h:71
int meta_data_set_value(Octstr *data, const char *group, const Octstr *key, const Octstr *value, int replace)
Definition: meta_data.c:324
static void kannel_parse_reply(SMSCConn *conn, Msg *msg, int status, List *headers, Octstr *body)
Definition: kannel.c:216
void uuid_unparse(const uuid_t uu, char *out)
Definition: gw_uuid.c:562
#define msg_create(type)
Definition: msg.h:136
void octstr_append_cstr(Octstr *ostr, const char *cstr)
Definition: octstr.c:1511
static void kannel_receive_sms(SMSCConn *conn, HTTPClient *client, List *headers, Octstr *body, List *cgivars)
Definition: kannel.c:249
Msg * dlr_find(const Octstr *smsc, const Octstr *ts, const Octstr *dst, int typ, int use_dst)
Definition: dlr.c:387
void dlr_add(const Octstr *smsc, const Octstr *ts, Msg *msg, int use_dst)
Definition: dlr.c:330
#define octstr_get_cstr(ostr)
Definition: octstr.h:233
void octstr_binary_to_hex(Octstr *ostr, int uppercase)
Definition: octstr.c:465
Octstr * charset
Definition: test_ota.c:68
Octstr * http_cgi_variable(List *list, char *name)
Definition: http.c:2836
void http_destroy_headers(List *headers)
Definition: http.c:2879
static Octstr * from
Definition: mtbatch.c:95
void http_start_request(HTTPCaller *caller, int method, Octstr *url, List *headers, Octstr *body, int follow, void *id, Octstr *certkeyfile)
Definition: http.c:1760
void http_send_reply(HTTPClient *client, int status, List *headers, Octstr *body)
Definition: http.c:2695
Octstr * octstr_imm(const char *cstr)
Definition: octstr.c:283
Definition: http.h:142
Definition: msg.h:79
static int kannel_send_sms(SMSCConn *conn, Msg *sms)
Definition: kannel.c:113
int no_coding
Definition: smsc_http_p.h:100
long bb_smscconn_receive(SMSCConn *conn, Msg *sms)
Definition: bb_smscconn.c:477
char * text
Definition: smsc_cimd2.c:921
int octstr_ncompare(const Octstr *ostr1, const Octstr *ostr2, long n)
Definition: octstr.c:952
#define METADATA_DLR_GROUP
Definition: meta_data.h:68
struct smsc_http_fn_callbacks smsc_http_kannel_callback
Definition: kannel.c:418
#define octstr_duplicate(ostr)
Definition: octstr.h:187
int octstr_case_compare(const Octstr *os1, const Octstr *os2)
Definition: octstr.c:903
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
int sms_charset_processing(Octstr *charset, Octstr *body, int coding)
Definition: sms.c:419
#define octstr_create(cstr)
Definition: octstr.h:125
#define SMS_PARAM_UNDEFINED
Definition: sms.h:91
int no_sender
Definition: smsc_http_p.h:99
#define UUID_STR_LEN
Definition: gw_uuid.h:19
#define DLR_UNDEFINED
Definition: dlr.h:70
long octstr_len(const Octstr *ostr)
Definition: octstr.c:342
#define MC_UNDEF
Definition: sms.h:93
Definition: octstr.c:118
void bb_smscconn_sent(SMSCConn *conn, Msg *sms, Octstr *reply)
Definition: bb_smscconn.c:281
Octstr * password
Definition: smsc_http_p.h:98
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:726
void octstr_format_append(Octstr *os, const char *fmt,...)
Definition: octstr.c:2507
#define gwlist_create()
Definition: list.h:136
Octstr * username
Definition: smsc_http_p.h:97
void bb_smscconn_send_failed(SMSCConn *conn, Msg *sms, int reason, Octstr *reply)
Definition: bb_smscconn.c:329
#define DC_UNDEF
Definition: sms.h:109
Octstr * send_url
Definition: smsc_http_p.h:93
static Octstr * url
Definition: test_xmlrpc.c:84
int octstr_get_char(const Octstr *ostr, long pos)
Definition: octstr.c:406
#define DLR_IS_ENABLED_DEVICE(dlr)
Definition: dlr.h:82
Definition: list.c:102
static Octstr * account
Definition: mtbatch.c:94
static XMLRPCDocument * msg
Definition: test_xmlrpc.c:86
#define DC_UCS2
Definition: sms.h:112
#define DC_7BIT
Definition: sms.h:110
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
Definition: octstr.c:871
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.