fedora 23
misc weakness #250


Weakness Breakdown


The software specifies permissions for a security-critical resource in a way that allows the resource to be read or modified by unintended actors.

Warning code(s):

It's often easy to fool getlogin. Sometimes it does not work at all, because some program messed up the utmp file. Often, it gives only the first 8 characters of the login name. The user currently logged in on the controlling tty of our program need not be the user who started it. Avoid getlogin.

File Name:



The highlighted line of code below is the trigger point of this particular Fedora 23 misc weakness.

 } ldaptoolSASLdefaults;

static int get_default(ldaptoolSASLdefaults *defaults, sasl_interact_t *interact, unsigned flags);
static int get_new_value(sasl_interact_t *interact, unsigned flags);

  Note that it is important to use "" (the empty string, length 0) as the default
  username value for non-interactive cases.  This allows the sasl library to find the best
  possible default.  For example, if using GSSAPI, you want the default value for
  the username to be extracted from the Kerberos tgt.  The sasl library will do
  that for you if you set the default username to "".
void *
ldaptool_set_sasl_defaults ( LDAP *ld, unsigned flags, char *mech, char *authid, char *username,
				 char *passwd, char *realm )
	ldaptoolSASLdefaults	*defaults;
	char			*login = NULL;

	if ((defaults = calloc(sizeof(ldaptoolSASLdefaults), 1)) == NULL) {
		return NULL;

	/* Try to get the login name */
	if ((login = getlogin()) == NULL) {
		login = "";

	if (mech) {
		defaults->mech = strdup(mech);
	} else {
		ldap_get_option(ld, LDAP_OPT_X_SASL_MECH, &defaults->mech);

	if (authid) { /* use explicit passed in value */
		defaults->authid = strdup(authid);
	} else { /* use option value if any */
		ldap_get_option(ld, LDAP_OPT_X_SASL_AUTHCID, &defaults->authid);
		if (!defaults->authid) {
			/* Default to the login name that is running the command */
			defaults->authid = strdup( login );

	if (username) { /* use explicit passed in value */
		defaults->username = strdup(username);
	} else { /* use option value if any */
		ldap_get_option(ld, LDAP_OPT_X_SASL_AUTHZID, &defaults->username);
		if (!defaults->username && (flags == LDAP_SASL_INTERACTIVE)) {
			/* Default to the login name that is running the command */ 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.