Deleted Added
full compact
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
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:
148 auth_group_auth_type
149 |
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
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 |
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 "
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
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\"",
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\"",
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 "
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 "
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 ---