userlookup_services.c
来自「this gives details of the network progra」· C语言 代码 · 共 61 行
C
61 行
/* * This is sample code generated by rpcgen. * These are only templates and you can use them * as a guideline for developing your own functions. */#include <pwd.h> /* needed for pw lookup functions */#include <sys/types.h> /* needed for pw database types */#include "userlookup.h"uid_retval * byname_1_svc(username *argp, struct svc_req *rqstp){ static uid_retval result; struct passwd *pw; /* argp is a pointer to: a string (a char *)! */ pw = getpwnam( *argp ); if (pw==0) { /* ERROR ! NO USER FOUND */ result.found=NOTFOUND; } else { result.found=FOUND; result.uid = pw->pw_uid; } return(&result);}char *error="ERROR";uname_retval * bynum_1_svc(int *argp, struct svc_req *rqstp){ static uname_retval result; struct passwd *pw; /* username is a pointer to: a string (a char *)! */ pw = getpwuid( *argp ); if (pw==0) { /* ERROR ! NO USER FOUND */ /* WE CANNOT RETURN A NULL (will screw up xdr filter) */ /* Point to an error string */ result.found=NOTFOUND; result.name=error; } else { result.found=FOUND; result.name = pw->pw_name; } return(&result);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?