• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

Tru64-FAQ-Security

发布: 2007-6-08 22:43 | 作者: seanhe | 来源: | 查看: 24次 | 进入软件测试论坛讨论

领测软件测试网
Tru64-FAQ-Security 
Security 1 -- How do I authenticate users on Tru64 UNIX?

Perhaps a bit of background first - generally the question is related to C2 or Enhanced Security, but the question always boils down to how can I take a given username and password and authenticate a user. Generally, this would be a combination of:


    pwd = getpwnam(username);
    if (strcmp(pwd->pw_passwd, crypt(password, pwd->pw_passwd)) == 0)
        return success;
    return fail;

The above assumes char *username and char *password are filled in with "precollected" username and password...
The problem/issue with this method is that for Enhanced Security configurations the pwd->pw_passwd field contains an asterisk ("*") and the password is actually stored in another database (/tcb/files/auth.db or /var/tcb/files/auth.db). In addition, the password found in those databases may not have been encrypted using the crypt() function.

Tru64 UNIX solves this by providing a general purpose function "sia_validate_user()" which will accept as parameters the username and password and perform the user authentication for you regardless of the security mechanism that is in place. Using the sia_validate_user() function relieves the programmer of needing to know what security mechanism is being used on the target Tru64 UNIX system.

The following is a code example which can be compiled and run as its own image or can be fit into an existing application which performs the getpwnam() and crypt() calls.


% cat siavaluser.c
#include 
#include 
#include 
#include 
#include 

int main(int argc, char *argv[])
{
int myargc = 1;
char *myargv[2];
char *user   = "someusername";
char *pass   = "yourpassword";
int auth_stat;

myargv[0] = "yourapplicationname";
myargv[1] = NULL;

set_auth_parameters(argc, argv);

    if (argc != 3) {
        fprintf(stderr, "usage: %s username password
", argv[0]);
        exit(1);
    }

    user = argv[1];
    pass = argv[2];

auth_stat =
sia_validate_user(NULL,myargc,myargv,NULL,user,NULL,0,NULL,pass);

if (auth_stat != SIASUCCESS ) {
 printf("No go %d", errno);
 perror("");
 }
printf ("Done
");
}

% cc -g -o siavaluser siavaluser.c -lsecurity
% ./siavaluser username password

 bjldlee 回复于:2004-11-26 21:40:52
set_auth_parameters(argc, argv); 这个函数是做什么用的?什么功能?

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网