View | Details | Raw Unified | Return to bug 758769
Collapse All | Expand All

(-)a/src/dialog-masterzone.ycp (-16 / +21 lines)
Lines 36-41 include "dns-server/misc.ycp"; Link Here
36
36
37
list <string> available_zones_to_connect = [];
37
list <string> available_zones_to_connect = [];
38
38
39
integer max_text_record_length = 255;
40
39
/**
41
/**
40
 * Dialog Tab - Zone Editor - Basics
42
 * Dialog Tab - Zone Editor - Basics
41
 * @return term for Get_ZoneEditorTab()
43
 * @return term for Get_ZoneEditorTab()
Lines 1014-1020 term GetEditationWidgets (string rec_type) { Link Here
1014
1016
1015
	    break;
1017
	    break;
1016
1018
1017
	// "A", "AAAA", "CNAME", "NS", "PTR", "TXT"
1019
	// "A", "AAAA", "CNAME", "NS", "PTR", "TXT", "SPF"
1018
	default:
1020
	default:
1019
	    ret = `HBox (
1021
	    ret = `HBox (
1020
		// Textentry - zone settings - Record Name
1022
		// Textentry - zone settings - Record Name
Lines 1043-1049 term GetMasterZoneEditorTabRecords () { Link Here
1043
    if (DnsServerHelperFunctions::IsReverseZone (current_zone["zone"]:"")) {
1045
    if (DnsServerHelperFunctions::IsReverseZone (current_zone["zone"]:"")) {
1044
	supported_records = [ "PTR", "NS" ];
1046
	supported_records = [ "PTR", "NS" ];
1045
    } else {
1047
    } else {
1046
	supported_records = [ "A", "AAAA", "CNAME", "NS", "MX", "SRV", "TXT" ];
1048
	supported_records = [ "A", "AAAA", "CNAME", "NS", "MX", "SRV", "TXT", "SPF" ];
1047
    }
1049
    }
1048
1050
1049
    map record_type_descriptions = $[
1051
    map record_type_descriptions = $[
Lines 1055-1060 term GetMasterZoneEditorTabRecords () { Link Here
1055
	"PTR"	: _("PTR: Reverse Translation"),
1057
	"PTR"	: _("PTR: Reverse Translation"),
1056
	"SRV"	: _("SRV: Services Record"),
1058
	"SRV"	: _("SRV: Services Record"),
1057
	"TXT"	: _("TXT: Text Record"),
1059
	"TXT"	: _("TXT: Text Record"),
1060
	"SPF"	: _("SPF: Sender Policy Framework"),
1058
    ];
1061
    ];
1059
1062
1060
    supported_records = maplist (any one_rec_type, supported_records, ``(
1063
    supported_records = maplist (any one_rec_type, supported_records, ``(
Lines 1177-1183 void AdjustEditationWidgets (map current_record, string & decoded_zone_name, str Link Here
1177
1180
1178
		break;
1181
		break;
1179
1182
1180
	    // "A", "AAAA", "CNAME", "NS", "PTR", "TXT"
1183
	    // "A", "AAAA", "CNAME", "NS", "PTR", "TXT", "SPF"
1181
	    default:
1184
	    default:
1182
		break;
1185
		break;
1183
	};
1186
	};
Lines 1306-1312 void StoreZoneRecordsTab () { Link Here
1306
/**
1309
/**
1307
 * Checks whether a given string is a valid TXT record key (name)
1310
 * Checks whether a given string is a valid TXT record key (name)
1308
 */
1311
 */
1309
boolean ValidTXTRecordName (string name) {
1312
boolean ValidTextRecordName (string name) {
1310
    // Checking the length
1313
    // Checking the length
1311
    if (name == nil || name == "") {
1314
    if (name == nil || name == "") {
1312
	y2warning ("TXT record key must not be empty");
1315
	y2warning ("TXT record key must not be empty");
Lines 1490-1509 or in the relative form to the current zone."), "*.ip6.arpa.")); Link Here
1490
	}
1493
	}
1491
	return true;
1494
	return true;
1492
1495
1493
    // -- TXT -- \\
1496
    // -- TXT or SPF -- \\
1494
    } else if (type == "TXT") {
1497
    } else if (type == "TXT" || type == "SPF") {
1495
	if (! ValidTXTRecordName(key)) {
1498
	if (! ValidTextRecordName(key)) {
1496
	    UI::SetFocus ( `id ("add_record_name") );
1499
	    UI::SetFocus ( `id ("add_record_name") );
1497
	    Popup::Error (_("Invalid TXT record key. It should consist of printable US-ASCII characters excluding '='
1500
	    // Error pop-up message, %1 is replaced with TXT or SPF
1498
and must be at least one character long."));
1501
	    Popup::Error (sformat(_("Invalid %1 record key. It should consist of printable US-ASCII characters excluding '='
1502
and must be at least one character long."), type));
1499
	    return false;
1503
	    return false;
1500
	}
1504
	}
1501
	if (size (val) > 255) {
1505
	if (size (val) > max_text_record_length) {
1502
	    UI::SetFocus (`id ("add_record_val"));
1506
	    UI::SetFocus (`id ("add_record_val"));
1503
	    // TRANSLATORS: Error message, %1 is replaced with the maximal length
1507
	    // TRANSLATORS: Error message, %1 is replaced with either TXT or SPF,
1504
	    // %2 with the current length of a new TXT record.
1508
	    // %2 with the maximal length,
1505
	    Popup::Error (sformat(_("Maximal length of a TXT record is %1 characters.
1509
	    // %3 with the current length of a new record
1506
This message is %2 characters long."), 255, size (val)));
1510
	    Popup::Error (sformat(_("Maximal %1 record length is %2 characters.
1511
This one is %3 characters long."), type, max_text_record_length, size (val)));
1507
	    return false;
1512
	    return false;
1508
	}
1513
	}
1509
	return true;
1514
	return true;
Lines 1549-1555 boolean CheckNewZoneRecordLogic (map <string, string> record) { Link Here
1549
    } else if (type == "SRV") {
1554
    } else if (type == "SRV") {
1550
	// FIXME: SRV should point to an A or AAAA record (if it is in the same domain)
1555
	// FIXME: SRV should point to an A or AAAA record (if it is in the same domain)
1551
	return true;
1556
	return true;
1552
    } else if (type == "TXT") {
1557
    } else if (type == "TXT" || type == "SPF") {
1553
	return true;
1558
	return true;
1554
    }
1559
    }
1555
1560
Lines 1719-1725 symbol HandleZoneRecordsTab (map event) { Link Here
1719
1724
1720
	    break;
1725
	    break;
1721
1726
1722
	// "A", "AAAA", "CNAME", "NS", "PTR", "TXT"
1727
	// "A", "AAAA", "CNAME", "NS", "PTR", "TXT", "SPF"
1723
	default:
1728
	default:
1724
	    break;
1729
	    break;
1725
    };
1730
    };

Return to bug 758769