Deleted Added
full compact
parse.y (263723) parse.y (263724)
1%{
2/*-
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * This software was developed by Edward Tomasz Napierala under sponsorship
7 * from the FreeBSD Foundation.
8 *

--- 13 unchanged lines hidden (view full) ---

22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
1%{
2/*-
3 * Copyright (c) 2012 The FreeBSD Foundation
4 * All rights reserved.
5 *
6 * This software was developed by Edward Tomasz Napierala under sponsorship
7 * from the FreeBSD Foundation.
8 *

--- 13 unchanged lines hidden (view full) ---

22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 *
30 * $FreeBSD: stable/10/usr.sbin/ctld/parse.y 263723 2014-03-25 12:10:30Z trasz $
30 * $FreeBSD: stable/10/usr.sbin/ctld/parse.y 263724 2014-03-25 12:12:37Z trasz $
31 */
32
33#include <sys/queue.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <assert.h>
37#include <stdio.h>
38#include <stdint.h>

--- 13 unchanged lines hidden (view full) ---

52static struct lun *lun = NULL;
53
54extern void yyerror(const char *);
55extern int yylex(void);
56extern void yyrestart(FILE *);
57
58%}
59
31 */
32
33#include <sys/queue.h>
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <assert.h>
37#include <stdio.h>
38#include <stdint.h>

--- 13 unchanged lines hidden (view full) ---

52static struct lun *lun = NULL;
53
54extern void yyerror(const char *);
55extern int yylex(void);
56extern void yyrestart(FILE *);
57
58%}
59
60%token ALIAS AUTH_GROUP BACKEND BLOCKSIZE CHAP CHAP_MUTUAL CLOSING_BRACKET
61%token DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP INITIATOR_NAME INITIATOR_PORTAL
62%token LISTEN LISTEN_ISER LUN MAXPROC NUM OPENING_BRACKET OPTION PATH PIDFILE
63%token PORTAL_GROUP SERIAL SIZE STR TARGET TIMEOUT
60%token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL
61%token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP INITIATOR_NAME
62%token INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC NUM OPENING_BRACKET
63%token OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR TARGET TIMEOUT
64
65%union
66{
67 uint64_t num;
68 char *str;
69}
70
71%token <num> NUM

--- 68 unchanged lines hidden (view full) ---

140 ;
141
142auth_group_entries:
143 |
144 auth_group_entries auth_group_entry
145 ;
146
147auth_group_entry:
64
65%union
66{
67 uint64_t num;
68 char *str;
69}
70
71%token <num> NUM

--- 68 unchanged lines hidden (view full) ---

140 ;
141
142auth_group_entries:
143 |
144 auth_group_entries auth_group_entry
145 ;
146
147auth_group_entry:
148 auth_group_auth_type
149 |
148 auth_group_chap
149 |
150 auth_group_chap_mutual
151 |
152 auth_group_initiator_name
153 |
154 auth_group_initiator_portal
155 ;
156
150 auth_group_chap
151 |
152 auth_group_chap_mutual
153 |
154 auth_group_initiator_name
155 |
156 auth_group_initiator_portal
157 ;
158
159auth_group_auth_type: AUTH_TYPE STR
160 {
161 int error;
162
163 error = auth_group_set_type_str(auth_group, $2);
164 free($2);
165 if (error != 0)
166 return (1);
167 }
168 ;
169
157auth_group_chap: CHAP STR STR
158 {
159 const struct auth *ca;
160
161 ca = auth_new_chap(auth_group, $2, $3);
162 free($2);
163 free($3);
164 if (ca == NULL)

--- 129 unchanged lines hidden (view full) ---

294 target_entries target_entry
295 ;
296
297target_entry:
298 target_alias
299 |
300 target_auth_group
301 |
170auth_group_chap: CHAP STR STR
171 {
172 const struct auth *ca;
173
174 ca = auth_new_chap(auth_group, $2, $3);
175 free($2);
176 free($3);
177 if (ca == NULL)

--- 129 unchanged lines hidden (view full) ---

307 target_entries target_entry
308 ;
309
310target_entry:
311 target_alias
312 |
313 target_auth_group
314 |
315 target_auth_type
316 |
302 target_chap
303 |
304 target_chap_mutual
305 |
306 target_initiator_name
307 |
308 target_initiator_portal
309 |

--- 15 unchanged lines hidden (view full) ---

325
326target_auth_group: AUTH_GROUP STR
327 {
328 if (target->t_auth_group != NULL) {
329 if (target->t_auth_group->ag_name != NULL)
330 log_warnx("auth-group for target \"%s\" "
331 "specified more than once", target->t_name);
332 else
317 target_chap
318 |
319 target_chap_mutual
320 |
321 target_initiator_name
322 |
323 target_initiator_portal
324 |

--- 15 unchanged lines hidden (view full) ---

340
341target_auth_group: AUTH_GROUP STR
342 {
343 if (target->t_auth_group != NULL) {
344 if (target->t_auth_group->ag_name != NULL)
345 log_warnx("auth-group for target \"%s\" "
346 "specified more than once", target->t_name);
347 else
333 log_warnx("cannot mix auth-group with explicit "
348 log_warnx("cannot use both auth-group and explicit "
334 "authorisations for target \"%s\"",
335 target->t_name);
336 return (1);
337 }
338 target->t_auth_group = auth_group_find(conf, $2);
339 if (target->t_auth_group == NULL) {
340 log_warnx("unknown auth-group \"%s\" for target "
341 "\"%s\"", $2, target->t_name);
342 return (1);
343 }
344 free($2);
345 }
346 ;
347
349 "authorisations for target \"%s\"",
350 target->t_name);
351 return (1);
352 }
353 target->t_auth_group = auth_group_find(conf, $2);
354 if (target->t_auth_group == NULL) {
355 log_warnx("unknown auth-group \"%s\" for target "
356 "\"%s\"", $2, target->t_name);
357 return (1);
358 }
359 free($2);
360 }
361 ;
362
363target_auth_type: AUTH_TYPE STR
364 {
365 int error;
366
367 if (target->t_auth_group != NULL) {
368 if (target->t_auth_group->ag_name != NULL) {
369 log_warnx("cannot use both auth-group and "
370 "auth-type for target \"%s\"",
371 target->t_name);
372 return (1);
373 }
374 } else {
375 target->t_auth_group = auth_group_new(conf, NULL);
376 if (target->t_auth_group == NULL) {
377 free($2);
378 return (1);
379 }
380 target->t_auth_group->ag_target = target;
381 }
382 error = auth_group_set_type_str(target->t_auth_group, $2);
383 free($2);
384 if (error != 0)
385 return (1);
386 }
387 ;
388
348target_chap: CHAP STR STR
349 {
350 const struct auth *ca;
351
352 if (target->t_auth_group != NULL) {
353 if (target->t_auth_group->ag_name != NULL) {
389target_chap: CHAP STR STR
390 {
391 const struct auth *ca;
392
393 if (target->t_auth_group != NULL) {
394 if (target->t_auth_group->ag_name != NULL) {
354 log_warnx("cannot mix auth-group with explicit "
355 "authorisations for target \"%s\"",
395 log_warnx("cannot use both auth-group and "
396 "chap for target \"%s\"",
356 target->t_name);
357 free($2);
358 free($3);
359 return (1);
360 }
361 } else {
362 target->t_auth_group = auth_group_new(conf, NULL);
363 if (target->t_auth_group == NULL) {

--- 12 unchanged lines hidden (view full) ---

376 ;
377
378target_chap_mutual: CHAP_MUTUAL STR STR STR STR
379 {
380 const struct auth *ca;
381
382 if (target->t_auth_group != NULL) {
383 if (target->t_auth_group->ag_name != NULL) {
397 target->t_name);
398 free($2);
399 free($3);
400 return (1);
401 }
402 } else {
403 target->t_auth_group = auth_group_new(conf, NULL);
404 if (target->t_auth_group == NULL) {

--- 12 unchanged lines hidden (view full) ---

417 ;
418
419target_chap_mutual: CHAP_MUTUAL STR STR STR STR
420 {
421 const struct auth *ca;
422
423 if (target->t_auth_group != NULL) {
424 if (target->t_auth_group->ag_name != NULL) {
384 log_warnx("cannot mix auth-group with explicit "
385 "authorisations for target \"%s\"",
425 log_warnx("cannot use both auth-group and "
426 "chap-mutual for target \"%s\"",
386 target->t_name);
387 free($2);
388 free($3);
389 free($4);
390 free($5);
391 return (1);
392 }
393 } else {

--- 19 unchanged lines hidden (view full) ---

413 ;
414
415target_initiator_name: INITIATOR_NAME STR
416 {
417 const struct auth_name *an;
418
419 if (target->t_auth_group != NULL) {
420 if (target->t_auth_group->ag_name != NULL) {
427 target->t_name);
428 free($2);
429 free($3);
430 free($4);
431 free($5);
432 return (1);
433 }
434 } else {

--- 19 unchanged lines hidden (view full) ---

454 ;
455
456target_initiator_name: INITIATOR_NAME STR
457 {
458 const struct auth_name *an;
459
460 if (target->t_auth_group != NULL) {
461 if (target->t_auth_group->ag_name != NULL) {
421 log_warnx("cannot mix auth-group with "
462 log_warnx("cannot use both auth-group and "
422 "initiator-name for target \"%s\"",
423 target->t_name);
424 free($2);
425 return (1);
426 }
427 } else {
428 target->t_auth_group = auth_group_new(conf, NULL);
429 if (target->t_auth_group == NULL) {

--- 10 unchanged lines hidden (view full) ---

440 ;
441
442target_initiator_portal: INITIATOR_PORTAL STR
443 {
444 const struct auth_portal *ap;
445
446 if (target->t_auth_group != NULL) {
447 if (target->t_auth_group->ag_name != NULL) {
463 "initiator-name for target \"%s\"",
464 target->t_name);
465 free($2);
466 return (1);
467 }
468 } else {
469 target->t_auth_group = auth_group_new(conf, NULL);
470 if (target->t_auth_group == NULL) {

--- 10 unchanged lines hidden (view full) ---

481 ;
482
483target_initiator_portal: INITIATOR_PORTAL STR
484 {
485 const struct auth_portal *ap;
486
487 if (target->t_auth_group != NULL) {
488 if (target->t_auth_group->ag_name != NULL) {
448 log_warnx("cannot mix auth-group with "
489 log_warnx("cannot use both auth-group and "
449 "initiator-portal for target \"%s\"",
450 target->t_name);
451 free($2);
452 return (1);
453 }
454 } else {
455 target->t_auth_group = auth_group_new(conf, NULL);
456 if (target->t_auth_group == NULL) {

--- 249 unchanged lines hidden ---
490 "initiator-portal for target \"%s\"",
491 target->t_name);
492 free($2);
493 return (1);
494 }
495 } else {
496 target->t_auth_group = auth_group_new(conf, NULL);
497 if (target->t_auth_group == NULL) {

--- 249 unchanged lines hidden ---