1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

nsswitch: Use C99 initializer for poptOption in wbinfo

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Andreas Schneider 2018-12-13 12:09:43 +01:00 committed by Andreas Schneider
parent cdf03f9206
commit 53e2e8c37d

View File

@ -2302,92 +2302,495 @@ int main(int argc, const char **argv, char **envp)
/* longName, shortName, argInfo, argPtr, value, descrip,
argDesc */
{ "domain-users", 'u', POPT_ARG_NONE, 0, 'u', "Lists all domain users", "domain"},
{ "domain-groups", 'g', POPT_ARG_NONE, 0, 'g', "Lists all domain groups", "domain" },
{ "WINS-by-name", 'N', POPT_ARG_STRING, &string_arg, 'N', "Converts NetBIOS name to IP", "NETBIOS-NAME" },
{ "WINS-by-ip", 'I', POPT_ARG_STRING, &string_arg, 'I', "Converts IP address to NetBIOS name", "IP" },
{ "name-to-sid", 'n', POPT_ARG_STRING, &string_arg, 'n', "Converts name to sid", "NAME" },
{ "sid-to-name", 's', POPT_ARG_STRING, &string_arg, 's', "Converts sid to name", "SID" },
{ "sid-to-fullname", 0, POPT_ARG_STRING, &string_arg,
OPT_SID_TO_FULLNAME, "Converts sid to fullname", "SID" },
{ "lookup-rids", 'R', POPT_ARG_STRING, &string_arg, 'R', "Converts RIDs to names", "RIDs" },
{ "lookup-sids", 0, POPT_ARG_STRING, &string_arg,
OPT_LOOKUP_SIDS, "Converts SIDs to types and names",
"Sid-List"},
{ "uid-to-sid", 'U', POPT_ARG_INT, &int_arg, 'U', "Converts uid to sid" , "UID" },
{ "gid-to-sid", 'G', POPT_ARG_INT, &int_arg, 'G', "Converts gid to sid", "GID" },
{ "sid-to-uid", 'S', POPT_ARG_STRING, &string_arg, 'S', "Converts sid to uid", "SID" },
{ "sid-to-gid", 'Y', POPT_ARG_STRING, &string_arg, 'Y', "Converts sid to gid", "SID" },
{ "allocate-uid", 0, POPT_ARG_NONE, 0, OPT_ALLOCATE_UID,
"Get a new UID out of idmap" },
{ "allocate-gid", 0, POPT_ARG_NONE, 0, OPT_ALLOCATE_GID,
"Get a new GID out of idmap" },
{ "set-uid-mapping", 0, POPT_ARG_STRING, &string_arg, OPT_SET_UID_MAPPING, "Create or modify uid to sid mapping in idmap", "UID,SID" },
{ "set-gid-mapping", 0, POPT_ARG_STRING, &string_arg, OPT_SET_GID_MAPPING, "Create or modify gid to sid mapping in idmap", "GID,SID" },
{ "remove-uid-mapping", 0, POPT_ARG_STRING, &string_arg, OPT_REMOVE_UID_MAPPING, "Remove uid to sid mapping in idmap", "UID,SID" },
{ "remove-gid-mapping", 0, POPT_ARG_STRING, &string_arg, OPT_REMOVE_GID_MAPPING, "Remove gid to sid mapping in idmap", "GID,SID" },
{ "sids-to-unix-ids", 0, POPT_ARG_STRING, &string_arg,
OPT_SIDS_TO_XIDS, "Translate SIDs to Unix IDs", "Sid-List" },
{ "unix-ids-to-sids", 0, POPT_ARG_STRING, &string_arg,
OPT_XIDS_TO_SIDS, "Translate Unix IDs to SIDs",
"ID-List (u<num> g<num>)" },
{ "check-secret", 't', POPT_ARG_NONE, 0, 't', "Check shared secret" },
{ "change-secret", 'c', POPT_ARG_NONE, 0, 'c', "Change shared secret" },
{ "ping-dc", 'P', POPT_ARG_NONE, 0, 'P',
"Check the NETLOGON connection" },
{ "trusted-domains", 'm', POPT_ARG_NONE, 0, 'm', "List trusted domains" },
{ "all-domains", 0, POPT_ARG_NONE, 0, OPT_LIST_ALL_DOMAINS, "List all domains (trusted and own domain)" },
{ "own-domain", 0, POPT_ARG_NONE, 0, OPT_LIST_OWN_DOMAIN, "List own domain" },
{ "sequence", 0, POPT_ARG_NONE, 0, OPT_SEQUENCE, "Deprecated command, see --online-status" },
{ "online-status", 0, POPT_ARG_NONE, 0, OPT_ONLINESTATUS, "Show whether domains maintain an active connection"},
{ "domain-info", 'D', POPT_ARG_STRING, &string_arg, 'D', "Show most of the info we have about the domain" },
{ "user-info", 'i', POPT_ARG_STRING, &string_arg, 'i', "Get user info", "USER" },
{ "uid-info", 0, POPT_ARG_INT, &int_arg, OPT_UID_INFO, "Get user info from uid", "UID" },
{ "group-info", 0, POPT_ARG_STRING, &string_arg, OPT_GROUP_INFO, "Get group info", "GROUP" },
{ "user-sidinfo", 0, POPT_ARG_STRING, &string_arg, OPT_USER_SIDINFO, "Get user info from sid", "SID" },
{ "gid-info", 0, POPT_ARG_INT, &int_arg, OPT_GID_INFO, "Get group info from gid", "GID" },
{ "user-groups", 'r', POPT_ARG_STRING, &string_arg, 'r', "Get user groups", "USER" },
{ "user-domgroups", 0, POPT_ARG_STRING, &string_arg,
OPT_USERDOMGROUPS, "Get user domain groups", "SID" },
{ "sid-aliases", 0, POPT_ARG_STRING, &string_arg, OPT_SIDALIASES, "Get sid aliases", "SID" },
{ "user-sids", 0, POPT_ARG_STRING, &string_arg, OPT_USERSIDS, "Get user group sids for user SID", "SID" },
{ "authenticate", 'a', POPT_ARG_STRING, &string_arg, 'a', "authenticate user", "user%password" },
{ "pam-logon", 0, POPT_ARG_STRING, &string_arg, OPT_PAM_LOGON,
"do a pam logon equivalent", "user%password" },
{ "logoff", 0, POPT_ARG_NONE, NULL, OPT_LOGOFF,
"log off user", "uid" },
{ "logoff-user", 0, POPT_ARG_STRING, &logoff_user,
OPT_LOGOFF_USER, "username to log off" },
{ "logoff-uid", 0, POPT_ARG_INT, &logoff_uid,
OPT_LOGOFF_UID, "uid to log off" },
{ "set-auth-user", 0, POPT_ARG_STRING, &string_arg, OPT_SET_AUTH_USER, "Store user and password used by winbindd (root only)", "user%password" },
{ "ccache-save", 0, POPT_ARG_STRING, &string_arg,
OPT_CCACHE_SAVE, "Store user and password for ccache "
"operation", "user%password" },
{ "getdcname", 0, POPT_ARG_STRING, &string_arg, OPT_GETDCNAME,
"Get a DC name for a foreign domain", "domainname" },
{ "dsgetdcname", 0, POPT_ARG_STRING, &string_arg, OPT_DSGETDCNAME, "Find a DC for a domain", "domainname" },
{ "dc-info", 0, POPT_ARG_STRING, &string_arg, OPT_DC_INFO,
"Find the currently known DCs", "domainname" },
{ "get-auth-user", 0, POPT_ARG_NONE, NULL, OPT_GET_AUTH_USER, "Retrieve user and password used by winbindd (root only)", NULL },
{ "ping", 'p', POPT_ARG_NONE, 0, 'p', "Ping winbindd to see if it is alive" },
{ "domain", 0, POPT_ARG_STRING, &opt_domain_name, OPT_DOMAIN_NAME, "Define to the domain to restrict operation", "domain" },
{
.longName = "domain-users",
.shortName = 'u',
.argInfo = POPT_ARG_NONE,
.val = 'u',
.descrip = "Lists all domain users",
.argDescrip = "domain"
},
{
.longName = "domain-groups",
.shortName = 'g',
.argInfo = POPT_ARG_NONE,
.val = 'g',
.descrip = "Lists all domain groups",
.argDescrip = "domain"
},
{
.longName = "WINS-by-name",
.shortName = 'N',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'N',
.descrip = "Converts NetBIOS name to IP",
.argDescrip = "NETBIOS-NAME"
},
{
.longName = "WINS-by-ip",
.shortName = 'I',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'I',
.descrip = "Converts IP address to NetBIOS name",
.argDescrip = "IP"
},
{
.longName = "name-to-sid",
.shortName = 'n',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'n',
.descrip = "Converts name to sid",
.argDescrip = "NAME"
},
{
.longName = "sid-to-name",
.shortName = 's',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 's',
.descrip = "Converts sid to name",
.argDescrip = "SID"
},
{
.longName = "sid-to-fullname",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_SID_TO_FULLNAME,
.descrip = "Converts sid to fullname",
.argDescrip = "SID"
},
{
.longName = "lookup-rids",
.shortName = 'R',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'R',
.descrip = "Converts RIDs to names",
.argDescrip = "RIDs"
},
{
.longName = "lookup-sids",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_LOOKUP_SIDS,
.descrip = "Converts SIDs to types and names",
.argDescrip = "Sid-List"
},
{
.longName = "uid-to-sid",
.shortName = 'U',
.argInfo = POPT_ARG_INT,
.arg = &int_arg,
.val = 'U',
.descrip = "Converts uid to sid",
.argDescrip = "UID"
},
{
.longName = "gid-to-sid",
.shortName = 'G',
.argInfo = POPT_ARG_INT,
.arg = &int_arg,
.val = 'G',
.descrip = "Converts gid to sid",
.argDescrip = "GID"
},
{
.longName = "sid-to-uid",
.shortName = 'S',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'S',
.descrip = "Converts sid to uid",
.argDescrip = "SID"
},
{
.longName = "sid-to-gid",
.shortName = 'Y',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'Y',
.descrip = "Converts sid to gid",
.argDescrip = "SID"
},
{
.longName = "allocate-uid",
.argInfo = POPT_ARG_NONE,
.val = OPT_ALLOCATE_UID,
.descrip = "Get a new UID out of idmap"
},
{
.longName = "allocate-gid",
.argInfo = POPT_ARG_NONE,
.val = OPT_ALLOCATE_GID,
.descrip = "Get a new GID out of idmap"
},
{
.longName = "set-uid-mapping",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_SET_UID_MAPPING,
.descrip = "Create or modify uid to sid mapping in "
"idmap",
.argDescrip = "UID,SID"
},
{
.longName = "set-gid-mapping",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_SET_GID_MAPPING,
.descrip = "Create or modify gid to sid mapping in "
"idmap",
.argDescrip = "GID,SID"
},
{
.longName = "remove-uid-mapping",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_REMOVE_UID_MAPPING,
.descrip = "Remove uid to sid mapping in idmap",
.argDescrip = "UID,SID"
},
{
.longName = "remove-gid-mapping",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_REMOVE_GID_MAPPING,
.descrip = "Remove gid to sid mapping in idmap",
.argDescrip = "GID,SID",
},
{
.longName = "sids-to-unix-ids",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_SIDS_TO_XIDS,
.descrip = "Translate SIDs to Unix IDs",
.argDescrip = "Sid-List",
},
{
.longName = "unix-ids-to-sids",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_XIDS_TO_SIDS,
.descrip = "Translate Unix IDs to SIDs",
.argDescrip = "ID-List (u<num> g<num>)",
},
{
.longName = "check-secret",
.shortName = 't',
.argInfo = POPT_ARG_NONE,
.val = 't',
.descrip = "Check shared secret",
},
{
.longName = "change-secret",
.shortName = 'c',
.argInfo = POPT_ARG_NONE,
.val = 'c',
.descrip = "Change shared secret",
},
{
.longName = "ping-dc",
.shortName = 'P',
.argInfo = POPT_ARG_NONE,
.val = 'P',
.descrip = "Check the NETLOGON connection",
},
{
.longName = "trusted-domains",
.shortName = 'm',
.argInfo = POPT_ARG_NONE,
.val = 'm',
.descrip = "List trusted domains",
},
{
.longName = "all-domains",
.argInfo = POPT_ARG_NONE,
.val = OPT_LIST_ALL_DOMAINS,
.descrip = "List all domains (trusted and own "
"domain)",
},
{
.longName = "own-domain",
.argInfo = POPT_ARG_NONE,
.val = OPT_LIST_OWN_DOMAIN,
.descrip = "List own domain",
},
{
.longName = "sequence",
.argInfo = POPT_ARG_NONE,
.val = OPT_SEQUENCE,
.descrip = "Deprecated command, see --online-status",
},
{
.longName = "online-status",
.argInfo = POPT_ARG_NONE,
.val = OPT_ONLINESTATUS,
.descrip = "Show whether domains maintain an active "
"connection",
},
{
.longName = "domain-info",
.shortName = 'D',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'D',
.descrip = "Show most of the info we have about the "
"domain",
},
{
.longName = "user-info",
.shortName = 'i',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'i',
.descrip = "Get user info",
.argDescrip = "USER",
},
{
.longName = "uid-info",
.argInfo = POPT_ARG_INT,
.arg = &int_arg,
.val = OPT_UID_INFO,
.descrip = "Get user info from uid",
.argDescrip = "UID",
},
{
.longName = "group-info",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_GROUP_INFO,
.descrip = "Get group info",
.argDescrip = "GROUP",
},
{
.longName = "user-sidinfo",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_USER_SIDINFO,
.descrip = "Get user info from sid",
.argDescrip = "SID",
},
{
.longName = "gid-info",
.argInfo = POPT_ARG_INT,
.arg = &int_arg,
.val = OPT_GID_INFO,
.descrip = "Get group info from gid",
.argDescrip = "GID",
},
{
.longName = "user-groups",
.shortName = 'r',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'r',
.descrip = "Get user groups",
.argDescrip = "USER",
},
{
.longName = "user-domgroups",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_USERDOMGROUPS,
.descrip = "Get user domain groups",
.argDescrip = "SID",
},
{
.longName = "sid-aliases",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_SIDALIASES,
.descrip = "Get sid aliases",
.argDescrip = "SID",
},
{
.longName = "user-sids",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_USERSIDS,
.descrip = "Get user group sids for user SID",
.argDescrip = "SID",
},
{
.longName = "authenticate",
.shortName = 'a',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'a',
.descrip = "authenticate user",
.argDescrip = "user%password",
},
{
.longName = "pam-logon",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_PAM_LOGON,
.descrip = "do a pam logon equivalent",
.argDescrip = "user%password",
},
{
.longName = "logoff",
.argInfo = POPT_ARG_NONE,
.val = OPT_LOGOFF,
.descrip = "log off user",
.argDescrip = "uid",
},
{
.longName = "logoff-user",
.argInfo = POPT_ARG_STRING,
.arg = &logoff_user,
.val = OPT_LOGOFF_USER,
.descrip = "username to log off"
},
{
.longName = "logoff-uid",
.argInfo = POPT_ARG_INT,
.arg = &logoff_uid,
.val = OPT_LOGOFF_UID,
.descrip = "uid to log off",
},
{
.longName = "set-auth-user",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_SET_AUTH_USER,
.descrip = "Store user and password used by "
"winbindd (root only)",
.argDescrip = "user%password",
},
{
.longName = "ccache-save",
.shortName = 0,
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_CCACHE_SAVE,
.descrip = "Store user and password for ccache "
"operation",
.argDescrip = "user%password",
},
{
.longName = "getdcname",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_GETDCNAME,
.descrip = "Get a DC name for a foreign domain",
.argDescrip = "domainname",
},
{
.longName = "dsgetdcname",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_DSGETDCNAME,
.descrip = "Find a DC for a domain",
.argDescrip = "domainname",
},
{
.longName = "dc-info",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_DC_INFO,
.descrip = "Find the currently known DCs",
.argDescrip = "domainname",
},
{
.longName = "get-auth-user",
.argInfo = POPT_ARG_NONE,
.val = OPT_GET_AUTH_USER,
.descrip = "Retrieve user and password used by "
"winbindd (root only)",
},
{
.longName = "ping",
.shortName = 'p',
.argInfo = POPT_ARG_NONE,
.arg = 0,
.val = 'p',
.descrip = "Ping winbindd to see if it is alive",
},
{
.longName = "domain",
.shortName = 0,
.argInfo = POPT_ARG_STRING,
.arg = &opt_domain_name,
.val = OPT_DOMAIN_NAME,
.descrip = "Define to the domain to restrict "
"operation",
.argDescrip = "domain",
},
#ifdef WITH_FAKE_KASERVER
{ "klog", 'k', POPT_ARG_STRING, &string_arg, 'k', "set an AFS token from winbind", "user%password" },
{
.longName = "klog",
.shortName = 'k',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'k',
.descrip = "set an AFS token from winbind",
.argDescrip = "user%password",
},
#endif
#ifdef HAVE_KRB5
{ "krb5auth", 'K', POPT_ARG_STRING, &string_arg, 'K', "authenticate user using Kerberos", "user%password" },
{
.longName = "krb5auth",
.shortName = 'K',
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = 'K',
.descrip = "authenticate user using Kerberos",
.argDescrip = "user%password",
},
/* destroys wbinfo --help output */
/* "user%password,DOM\\user%password,user@EXAMPLE.COM,EXAMPLE.COM\\user%password" }, */
{ "krb5ccname", 0, POPT_ARG_STRING, &opt_krb5ccname, OPT_KRB5CCNAME, "authenticate user using Kerberos and specific credential cache type", "krb5ccname" },
/* "user%password,DOM\\user%password,user@EXAMPLE.COM,EXAMPLE.COM\\user%password" },
*/
{
.longName = "krb5ccname",
.argInfo = POPT_ARG_STRING,
.arg = &opt_krb5ccname,
.val = OPT_KRB5CCNAME,
.descrip = "authenticate user using Kerberos and "
"specific credential cache type",
.argDescrip = "krb5ccname",
},
#endif
{ "separator", 0, POPT_ARG_NONE, 0, OPT_SEPARATOR, "Get the active winbind separator", NULL },
{ "verbose", 0, POPT_ARG_NONE, 0, OPT_VERBOSE, "Print additional information per command", NULL },
{ "change-user-password", 0, POPT_ARG_STRING, &string_arg, OPT_CHANGE_USER_PASSWORD, "Change the password for a user", NULL },
{ "ntlmv1", 0, POPT_ARG_NONE, 0, OPT_NTLMV1,
"Use NTLMv1 cryptography for user authentication", NULL},
{ "ntlmv2", 0, POPT_ARG_NONE, 0, OPT_NTLMV2, "Use NTLMv2 cryptography for user authentication", NULL},
{ "lanman", 0, POPT_ARG_NONE, 0, OPT_LANMAN, "Use lanman cryptography for user authentication", NULL},
{
.longName = "separator",
.argInfo = POPT_ARG_NONE,
.val = OPT_SEPARATOR,
.descrip = "Get the active winbind separator",
},
{
.longName = "verbose",
.argInfo = POPT_ARG_NONE,
.val = OPT_VERBOSE,
.descrip = "Print additional information per command",
},
{
.longName = "change-user-password",
.argInfo = POPT_ARG_STRING,
.arg = &string_arg,
.val = OPT_CHANGE_USER_PASSWORD,
.descrip = "Change the password for a user",
},
{
.longName = "ntlmv1",
.argInfo = POPT_ARG_NONE,
.val = OPT_NTLMV1,
.descrip = "Use NTLMv1 cryptography for user authentication",
},
{
.longName = "ntlmv2",
.argInfo = POPT_ARG_NONE,
.val = OPT_NTLMV2,
.descrip = "Use NTLMv2 cryptography for user authentication",
},
{
.longName = "lanman",
.argInfo = POPT_ARG_NONE,
.val = OPT_LANMAN,
.descrip = "Use lanman cryptography for user authentication",
},
POPT_COMMON_VERSION
POPT_TABLEEND
};