~ubuntu-branches/ubuntu/trusty/haproxy/trusty-updates

« back to all changes in this revision

Viewing changes to src/uri_auth.c

  • Committer: Bazaar Package Importer
  • Author(s): Arnaud Cornet
  • Date: 2009-10-19 22:31:45 UTC
  • mfrom: (1.2.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: james.westby@ubuntu.com-20091019223145-rymupk5njs544bvp
ImportĀ upstreamĀ versionĀ 1.3.22

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
}
111
111
 
112
112
/*
 
113
 * Returns a default uri_auth with ST_SHNODE flag enabled and
 
114
 * <node> set as the name if it is not empty.
 
115
 * Uses the pointer provided if not NULL and not initialized.
 
116
 */
 
117
struct uri_auth *stats_set_node(struct uri_auth **root, char *name)
 
118
{
 
119
        struct uri_auth *u;
 
120
        char *node_copy = NULL;
 
121
 
 
122
        if (name && *name) {
 
123
                node_copy = strdup(name);
 
124
                if (node_copy == NULL)
 
125
                        goto out_realm;
 
126
        }
 
127
        
 
128
        if ((u = stats_check_init_uri_auth(root)) == NULL)
 
129
                goto out_u;
 
130
 
 
131
        if (!stats_set_flag(root, ST_SHNODE))
 
132
                goto out_u;
 
133
 
 
134
        if (node_copy) {        
 
135
                free(u->node);
 
136
                u->node = node_copy;
 
137
        }
 
138
 
 
139
        return u;
 
140
 
 
141
 out_u:
 
142
        free(node_copy);
 
143
 out_realm:
 
144
        return NULL;
 
145
}
 
146
 
 
147
/*
 
148
 * Returns a default uri_auth with ST_SHDESC flag enabled and
 
149
 * <description> set as the desc if it is not empty.
 
150
 * Uses the pointer provided if not NULL and not initialized.
 
151
 */
 
152
struct uri_auth *stats_set_desc(struct uri_auth **root, char *desc)
 
153
{
 
154
        struct uri_auth *u;
 
155
        char *desc_copy = NULL;
 
156
 
 
157
        if (desc && *desc) {
 
158
                desc_copy = strdup(desc);
 
159
                if (desc_copy == NULL)
 
160
                        goto out_realm;
 
161
        }
 
162
        
 
163
        if ((u = stats_check_init_uri_auth(root)) == NULL)
 
164
                goto out_u;
 
165
 
 
166
        if (!stats_set_flag(root, ST_SHDESC))
 
167
                goto out_u;
 
168
 
 
169
        if (desc_copy) {
 
170
                free(u->desc);
 
171
                u->desc = desc_copy;
 
172
        }
 
173
 
 
174
        return u;
 
175
 
 
176
 out_u:
 
177
        free(desc_copy);
 
178
 out_realm:
 
179
        return NULL;
 
180
}
 
181
 
 
182
/*
113
183
 * Returns a default uri_auth with the <refresh> refresh interval.
114
184
 * Uses the pointer provided if not NULL and not initialized.
115
185
 */