Package: dpkg
Version: 1.16.8
Followup-For: Bug #684332

Hello,

I did a few tests:

> «env|grep picca»

picca@mordor:~/Projets$ su
Mot de passe :
root@mordor:/home/picca/Projets# env | grep picca
GNOME_KEYRING_CONTROL=/home/picca/.cache/keyring-15gwxk
DEBEMAIL=pi...@debian.org
USERNAME=picca
PWD=/home/picca/Projets
REPREPRO_BASE_DIR=/home/picca/Debian/repo
XAUTHORITY=/var/run/gdm3/auth-for-picca-M0Df0g/database

so I find plenty of picca ok

the connection problem with mysql is present.

now

picca@mordor:~/Projets$ su -
Mot de passe :
root@mordor:~# env | grep picca
XAUTHORITY=/var/run/gdm3/auth-for-picca-M0Df0g/database

now more picca but still the problem during the mysql connection ???

I looked at the tango code:

the connection is done with this commande where mysql_user and mysql_passwd are
NULL.
so it delegate the user and passwd to the mysql library.

if (!mysql_real_connect(conn_pool[loop].db, NULL, mysql_user, mysql_password,
database, 0, NULL, CLIENT_MULTI_STATEMENTS))

I red the documentation of mysql [1] and is seems that this method use the
login name when user and passwd are NULL.

I also looked at the code of mysql and it seems that it use getlogin or cuserid
depending on some config.h values

void read_user_name(char *name)
{
  DBUG_ENTER("read_user_name");
  if (geteuid() == 0)
    (void) strmov(name,"root");         /* allow use of surun */
  else
  {
#ifdef HAVE_GETPWUID
    struct passwd *skr;
    const char *str;
    if ((str=getlogin()) == NULL)
    {
      if ((skr=getpwuid(geteuid())) != NULL)
        str=skr->pw_name;
      else if (!(str=getenv("USER")) && !(str=getenv("LOGNAME")) &&
               !(str=getenv("LOGIN")))
        str="UNKNOWN_USER";
    }
    (void) strmake(name,str,USERNAME_LENGTH);
#elif HAVE_CUSERID
    (void) cuserid(name);
#else
    strmov(name,"UNKNOWN_USER");
#endif
  }
  DBUG_VOID_RETURN;
}

so I wrote a very simple test program :)


#include <stdio.h>
#include <unistd.h>

int main()
{
        fprintf(stdout, "cuserid: %s\n", cuserid(NULL));
        fprintf(stdout, "getlogin: %s\n", getlogin());
}

and indeed

picca@mordor:~/tmp$ su
Mot de passe :
root@mordor:/home/picca/tmp# ./a.out
cuserid: root
getlogin: picca

so it seems to me that mysql use getlogin with the 5.5 version.

the code of 5.1 is not that different from the 5.5 one

so maybe the config.h options where different between 5.1 and 5.5 ?

all I can says is that a few mount earlyer I did not had this conection
problem.

how can I check the config.h file of 5.1 and 5.5

thanks

Frederic

[1] http://dev.mysql.com/doc/refman/5.5/en/mysql-real-connect.html



-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-3-486
Locale: LANG=fr_CA.UTF-8, LC_CTYPE=fr_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg depends on:
ii  libbz2-1.0   1.0.6-4
ii  libc6        2.13-35
ii  liblzma5     5.1.1alpha+20120614-1
ii  libselinux1  2.1.9-5
ii  tar          1.26-4
ii  zlib1g       1:1.2.7.dfsg-13

dpkg recommends no packages.

Versions of packages dpkg suggests:
ii  apt  0.9.7.4

-- no debconf information


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to