954,116 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Program security (When Launched)

I hope this makes sense... I made a program which requires authorization by username and password, once logged in it will allow you to load a program. My question is, is there a tutorial for the program being called to only open if it has been called by a certain program (Only a certain program can open it).

I was looking up google for tutorials and fstream, but I cannot find anything. Could someone please push me in the right direction?

Thanks in advance,
Rave

Raven11
Light Poster
36 posts since Mar 2005
Reputation Points: 11
Solved Threads: 1
 

Off the top of my head I would say it's not easily possible unless you set up the calling program to run as a unique user. Then you could check to see what user owns your program's process (such as with ps) and terminate if it isn't the right one.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

You could also use a pseudorandom number calculated by the same means on both the client and server programs. You could pass this via an IPC mechanicsm. Not exactly 'secure', but would keep anybody from randomly executing.

dale

hostmoon
Newbie Poster
19 posts since Aug 2004
Reputation Points: 10
Solved Threads: 0
 

I have a idea that will work, once program A is open it will create a .bmp file with encrypted characters. The program B will search for this file and have the correct characters in it. If not it does not open.

However, I want to make it so when Program A is closed, the file is deleted (so program B wont run). How do I delete the bmp file after its been created?

Raven11
Light Poster
36 posts since Mar 2005
Reputation Points: 11
Solved Threads: 1
 

from google

http://www.computing.net/programming/wwwboard/forum/12045.html

#include <stdio.h>

if(remove("myfile.txt") == -1)

    fprintf(stderr,"Remove failed");


apparently the remove() function is what you are after. www.cplusplus.com might have a reference for this function

1o0oBhP
Posting Pro in Training
445 posts since Dec 2004
Reputation Points: 16
Solved Threads: 6
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You