rv = apr_get_userid(&userid, &groupid, username, p); if (rv != APR_SUCCESS) { fprintf(stderr, "apr_get_userid(,,%s,) failed: %s\n", username, apr_strerror(rv, msgbuf, sizeof(msgbuf))); exit(-1); } else { printf("user/group ids for %s: %d/%d\n", username, (int)userid, (int)groupid); }
guys ... userid isn't!!! This is a really cruddy example. If you want to create an apr_strfuid to display for the user, then _fine_! But we need to kill this example, which I will go ahead a do by the weekend if nobody wants to salvage this. BTW, we should simply pass a pool and let the apr_strfuid allocate what it needs, on win32 these can grow to about, well, a very long number, such as S-1-5-21-527223456-839523456-1060223456-502 The code to format a sid is already in apr/user/win32/userinfo.c and I won't object to it becoming public (with the usual name.) Bill