@@ -80,6 +80,9 @@ struct WOLFSSHD_CONFIG {
80
80
char * authKeysFile ;
81
81
char * forceCmd ;
82
82
char * pidFile ;
83
+ char * winUserStores ;
84
+ char * winUserDwFlags ;
85
+ char * winUserPvPara ;
83
86
WOLFSSHD_CONFIG * next ; /* next config in list */
84
87
long loginTimer ;
85
88
word16 port ;
@@ -90,6 +93,7 @@ struct WOLFSSHD_CONFIG {
90
93
byte permitEmptyPasswords :1 ;
91
94
byte authKeysFileSet :1 ; /* if not set then no explicit authorized keys */
92
95
byte useSystemCA :1 ;
96
+ byte useUserCAStore :1 ;
93
97
};
94
98
95
99
int CountWhitespace (const char * in , int inSz , byte inv );
@@ -313,6 +317,9 @@ void wolfSSHD_ConfigFree(WOLFSSHD_CONFIG* conf)
313
317
FreeString (& current -> hostKeyFile , heap );
314
318
FreeString (& current -> hostCertFile , heap );
315
319
FreeString (& current -> pidFile , heap );
320
+ FreeString (& current -> winUserStores , heap );
321
+ FreeString (& current -> winUserDwFlags , heap );
322
+ FreeString (& current -> winUserPvPara , heap );
316
323
317
324
WFREE (current , heap , DYNTYPE_SSHD );
318
325
current = next ;
@@ -352,9 +359,13 @@ enum {
352
359
OPT_PIDFILE = 22 ,
353
360
OPT_BANNER = 23 ,
354
361
OPT_TRUSTED_SYSTEM_CA_KEYS = 24 ,
362
+ OPT_TRUSTED_USER_CA_STORE = 25 ,
363
+ OPT_WIN_USER_STORES = 26 ,
364
+ OPT_WIN_USER_DW_FLAGS = 27 ,
365
+ OPT_WIN_USER_PV_PARA = 28
355
366
};
356
367
enum {
357
- NUM_OPTIONS = 24
368
+ NUM_OPTIONS = 29
358
369
};
359
370
360
371
static const CONFIG_OPTION options [NUM_OPTIONS ] = {
@@ -383,6 +394,10 @@ static const CONFIG_OPTION options[NUM_OPTIONS] = {
383
394
{OPT_TRUSTED_SYSTEM_CA_KEYS , "TrustedSystemCAKeys" },
384
395
{OPT_PIDFILE , "PidFile" },
385
396
{OPT_BANNER , "Banner" },
397
+ {OPT_TRUSTED_USER_CA_STORE , "TrustedUserCaStore" },
398
+ {OPT_WIN_USER_STORES , "WinUserStores" },
399
+ {OPT_WIN_USER_DW_FLAGS , "WinUserDwFlags" },
400
+ {OPT_WIN_USER_PV_PARA , "WinUserPvPara" },
386
401
};
387
402
388
403
/* returns WS_SUCCESS on success */
@@ -1033,6 +1048,18 @@ static int HandleConfigOption(WOLFSSHD_CONFIG** conf, int opt,
1033
1048
case OPT_BANNER :
1034
1049
ret = SetFileString (& (* conf )-> banner , value , (* conf )-> heap );
1035
1050
break ;
1051
+ case OPT_TRUSTED_USER_CA_STORE :
1052
+ ret = wolfSSHD_ConfigSetUserCAStore (* conf , value );
1053
+ break ;
1054
+ case OPT_WIN_USER_STORES :
1055
+ ret = wolfSSHD_ConfigSetWinUserStores (* conf , value );
1056
+ break ;
1057
+ case OPT_WIN_USER_DW_FLAGS :
1058
+ ret = wolfSSHD_ConfigSetWinUserDwFlags (* conf , value );
1059
+ break ;
1060
+ case OPT_WIN_USER_PV_PARA :
1061
+ ret = wolfSSHD_ConfigSetWinUserPvPara (* conf , value );
1062
+ break ;
1036
1063
default :
1037
1064
break ;
1038
1065
}
@@ -1352,6 +1379,119 @@ int wolfSSHD_ConfigSetSystemCA(WOLFSSHD_CONFIG* conf, const char* value)
1352
1379
return ret ;
1353
1380
}
1354
1381
1382
+ /* getter function for if using user CA store
1383
+ * return 1 if true and 0 if false */
1384
+ int wolfSSHD_ConfigGetUserCAStore (const WOLFSSHD_CONFIG * conf )
1385
+ {
1386
+ if (conf != NULL ) {
1387
+ return conf -> useUserCAStore ;
1388
+ }
1389
+ return 0 ;
1390
+ }
1391
+
1392
+
1393
+ /* setter function for if using user CA store
1394
+ * 'yes' if true and 'no' if false
1395
+ * returns WS_SUCCESS on success */
1396
+ int wolfSSHD_ConfigSetUserCAStore (WOLFSSHD_CONFIG * conf , const char * value )
1397
+ {
1398
+ int ret = WS_SUCCESS ;
1399
+
1400
+ if (conf != NULL ) {
1401
+ if (WSTRCMP (value , "yes" ) == 0 ) {
1402
+ wolfSSH_Log (WS_LOG_INFO , "[SSHD] User CA store enabled. Note this "
1403
+ "is currently only supported on Windows." );
1404
+ conf -> useUserCAStore = 1 ;
1405
+ }
1406
+ else if (WSTRCMP (value , "no" ) == 0 ) {
1407
+ wolfSSH_Log (WS_LOG_INFO , "[SSHD] User CA store disabled" );
1408
+ conf -> useUserCAStore = 0 ;
1409
+ }
1410
+ else {
1411
+ wolfSSH_Log (WS_LOG_INFO , "[SSHD] User CA store unexpected flag" );
1412
+ ret = WS_FATAL_ERROR ;
1413
+ }
1414
+ }
1415
+
1416
+ return ret ;
1417
+ }
1418
+
1419
+ char * wolfSSHD_ConfigGetWinUserStores (WOLFSSHD_CONFIG * conf ) {
1420
+ if (conf != NULL ) {
1421
+ if (conf -> winUserStores == NULL ) {
1422
+ /* If no value was specified, default to CERT_STORE_PROV_SYSTEM */
1423
+ CreateString (& conf -> winUserStores , "CERT_STORE_PROV_SYSTEM" ,
1424
+ (int )WSTRLEN ("CERT_STORE_PROV_SYSTEM" ), conf -> heap );
1425
+ }
1426
+
1427
+ return conf -> winUserStores ;
1428
+ }
1429
+
1430
+ return NULL ;
1431
+ }
1432
+
1433
+ int wolfSSHD_ConfigSetWinUserStores (WOLFSSHD_CONFIG * conf , const char * value ) {
1434
+ int ret = WS_SUCCESS ;
1435
+
1436
+ if (conf == NULL ) {
1437
+ ret = WS_BAD_ARGUMENT ;
1438
+ }
1439
+
1440
+ ret = CreateString (& conf -> winUserStores , value , (int )WSTRLEN (value ), conf -> heap );
1441
+
1442
+ return ret ;
1443
+ }
1444
+
1445
+ char * wolfSSHD_ConfigGetWinUserDwFlags (WOLFSSHD_CONFIG * conf ) {
1446
+ if (conf != NULL ) {
1447
+ if (conf -> winUserDwFlags == NULL ) {
1448
+ /* If no value was specified, default to CERT_SYSTEM_STORE_CURRENT_USER */
1449
+ CreateString (& conf -> winUserDwFlags , "CERT_SYSTEM_STORE_CURRENT_USER" ,
1450
+ (int )WSTRLEN ("CERT_SYSTEM_STORE_CURRENT_USER" ), conf -> heap );
1451
+ }
1452
+
1453
+ return conf -> winUserDwFlags ;
1454
+ }
1455
+
1456
+ return NULL ;
1457
+ }
1458
+
1459
+ int wolfSSHD_ConfigSetWinUserDwFlags (WOLFSSHD_CONFIG * conf , const char * value ) {
1460
+ int ret = WS_SUCCESS ;
1461
+
1462
+ if (conf == NULL ) {
1463
+ ret = WS_BAD_ARGUMENT ;
1464
+ }
1465
+
1466
+ ret = CreateString (& conf -> winUserDwFlags , value , (int )WSTRLEN (value ), conf -> heap );
1467
+
1468
+ return ret ;
1469
+ }
1470
+
1471
+ char * wolfSSHD_ConfigGetWinUserPvPara (WOLFSSHD_CONFIG * conf ) {
1472
+ if (conf != NULL ) {
1473
+ if (conf -> winUserPvPara == NULL ) {
1474
+ /* If no value was specified, default to MY */
1475
+ CreateString (& conf -> winUserPvPara , "MY" , (int )WSTRLEN ("MY" ), conf -> heap );
1476
+ }
1477
+
1478
+ return conf -> winUserPvPara ;
1479
+ }
1480
+
1481
+ return NULL ;
1482
+ }
1483
+
1484
+ int wolfSSHD_ConfigSetWinUserPvPara (WOLFSSHD_CONFIG * conf , const char * value ) {
1485
+ int ret = WS_SUCCESS ;
1486
+
1487
+ if (conf == NULL ) {
1488
+ ret = WS_BAD_ARGUMENT ;
1489
+ }
1490
+
1491
+ ret = CreateString (& conf -> winUserPvPara , value , (int )WSTRLEN (value ), conf -> heap );
1492
+
1493
+ return ret ;
1494
+ }
1355
1495
1356
1496
char * wolfSSHD_ConfigGetUserCAKeysFile (const WOLFSSHD_CONFIG * conf )
1357
1497
{
0 commit comments