+static int pw2kt_validate_spn_spec(const char *line, char *option)
+{
+ char *p = NULL;
+
+ /* Check for simple tokens */
+ if (strequal(option, ":account_name") ||
+ strequal(option, ":sync_account_name") ||
+ strequal(option, ":sync_upn") ||
+ strequal(option, ":sync_spns"))
+ {
+ *option = 0;
+ return 0;
+ }
+
+ /* Check for key=value tokens */
+ if ((p = strrchr_m(option, '='))) {
+ if (strlen(p) <= 1) {
+ fprintf(stderr, "ERROR: Empty value "
+ "for spn_spec option '%s'\n", option);
+ return 1;
+ }
+ *p = 0;
+ if (strequal(option, ":spn_prefixes") ||
+ strequal(option, ":spns"))
+ {
+ *option = 0;
+ return 0;
+ }
+ fprintf(stderr,
+ "ERROR: only SPN specifier 'spns' and 'spn_prefixes' "
+ "can contain '=' and comma separated list of values "
+ "in line:\n%s\noption:%s\n", line, option);
+ return 1;
+ }
+
+ fprintf(stderr, "ERROR: Invalid spn_spec value: %s\n", option);
+
+ return 1;
+}
+