~ubuntu-branches/ubuntu/natty/lighttpd/natty

« back to all changes in this revision

Viewing changes to src/configfile-glue.c

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Krzyżaniak (eloy)
  • Date: 2009-10-30 17:37:29 UTC
  • mto: (6.1.4 squeeze)
  • mto: This revision was merged to the branch mainline in revision 50.
  • Revision ID: james.westby@ubuntu.com-20091030173729-ehmsdiba9nkcd0j7
Tags: upstream-1.4.24
Import upstream version 1.4.24

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <string.h>
2
 
#include <stdlib.h>
3
 
 
4
1
#include "base.h"
5
2
#include "buffer.h"
6
3
#include "array.h"
9
6
 
10
7
#include "configfile.h"
11
8
 
 
9
#include <string.h>
 
10
#include <stdlib.h>
 
11
 
12
12
/**
13
13
 * like all glue code this file contains functions which
14
14
 * are the external interface of lighttpd. The functions
103
103
                                        if (e != ds->value->ptr && !*e && l >=0 && l <= 65535) {
104
104
                                                *((unsigned short *)(cv[i].destination)) = l;
105
105
                                                break;
106
 
 
107
106
                                        }
108
107
                                }
109
108
 
112
111
                                return -1;
113
112
                        }
114
113
                        default:
115
 
                                log_error_write(srv, __FILE__, __LINE__, "ssds", "unexpected type for key:", cv[i].key, du->type, "expected a integer, range 0 ... 65535");
 
114
                                log_error_write(srv, __FILE__, __LINE__, "ssds", "unexpected type for key:", cv[i].key, du->type, "expected a short integer, range 0 ... 65535");
 
115
                                return -1;
 
116
                        }
 
117
                        break;
 
118
                case T_CONFIG_INT:
 
119
                        switch(du->type) {
 
120
                        case TYPE_INTEGER: {
 
121
                                data_integer *di = (data_integer *)du;
 
122
 
 
123
                                *((unsigned int *)(cv[i].destination)) = di->value;
 
124
                                break;
 
125
                        }
 
126
                        case TYPE_STRING: {
 
127
                                data_string *ds = (data_string *)du;
 
128
 
 
129
                                if (ds->value->ptr && *ds->value->ptr) {
 
130
                                        char *e;
 
131
                                        long l = strtol(ds->value->ptr, &e, 10);
 
132
                                        if (e != ds->value->ptr && !*e && l >= 0) {
 
133
                                                *((unsigned int *)(cv[i].destination)) = l;
 
134
                                                break;
 
135
                                        }
 
136
                                }
 
137
 
 
138
 
 
139
                                log_error_write(srv, __FILE__, __LINE__, "ssb", "got a string but expected an integer:", cv[i].key, ds->value);
 
140
 
 
141
                                return -1;
 
142
                        }
 
143
                        default:
 
144
                                log_error_write(srv, __FILE__, __LINE__, "ssds", "unexpected type for key:", cv[i].key, du->type, "expected an integer, range 0 ... 4294967295");
116
145
                                return -1;
117
146
                        }
118
147
                        break;
289
318
                        default:
290
319
                                break;
291
320
                        }
 
321
#if defined USE_OPENSSL && ! defined OPENSSL_NO_TLSEXT
 
322
                } else if (!buffer_is_empty(con->tlsext_server_name)) {
 
323
                        l = con->tlsext_server_name;
 
324
#endif
292
325
                } else {
293
326
                        l = srv->empty_string;
294
327
                }